Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option component #2884

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Option component #2884

wants to merge 8 commits into from

Conversation

olemartinorg
Copy link
Contributor

@olemartinorg olemartinorg commented Jan 8, 2025

Status

  • Waiting for feedback and refinement to UI
  • I didn't fix the issues regarding missing label and aria-labelledby in the new Option component (I only did it in all the others), so that needs fixing
  • Visual testing remains for Summary and Summary2 of an Option component
  • This all depends on updates to ttd/frontend-test and percy snapshots, so I don't see a need for frequent pushes to this branch.

Description

Adding the Option presentation component, as described in #2752. It can be configured as such:

{
  "id": "pet-species-option",
  "type": "Option",
  "textResourceBindings": {
    "title": "Art"
  },
  "value": ["dataModel", "Pets.Species"],
  "optionsId": "pet-species",
  "direction": "vertical"
}

The list of options can be configured just like any other option-supporting component, and the selected option value should be placed in the value property (which will usually call an expression).

Details:

  • The component will show description and helpText, if set on the selected option
  • When summarized, it will only show the label, not the description and help text (currently, at least - I don't know what we really want in this aspect).
  • The Option component doesn't support any option-effects (i.e. it cannot store the label for the selected value into the data model, and it will not remove invalid values from the data model, etc).

In the process I also fixed a few problems in the existing Text, Number and Date components:

  • I switched to calling useNodeItem() for each property instead of getting all of them. Fetching everything is overkill, just like SELECT * FROM table.
  • The components were not translating the title text resource binding in the icon alt text
  • The components were also outputting aria-labelledby even when there is no label

Related Issue(s)

Verification/QA

  • Manual functionality testing
    • I have tested these changes manually
    • Creator of the original issue (or service owner) has been contacted for manual testing (or will be contacted when released in alpha)
    • No testing done/necessary
  • Automated tests
    • Unit test(s) have been added/updated
    • Cypress E2E test(s) have been added/updated
    • No automatic tests are needed here (no functional changes/additions)
    • I want someone to help me make some tests
  • UU/WCAG (follow these guidelines until we have our own)
    • I have tested with a screen reader/keyboard navigation/automated wcag validator
    • No testing done/necessary (no DOM/visual changes)
    • I want someone to help me perform accessibility testing
  • User documentation @ altinn-studio-docs
    • Has been added/updated
    • No functionality has been changed/added, so no documentation is needed
    • I will do that later/have created an issue
  • Support in Altinn Studio
    • Issue(s) created for support in Studio
    • This change/feature does not require any changes to Altinn Studio
  • Sprint board
    • The original issue (or this PR itself) has been added to the Team Apps project and to the current sprint board
    • I don't have permissions to do that, please help me out
  • Labels
    • I have added a kind/* label to this PR for proper release notes grouping
    • I don't have permissions to add labels, please help me out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/product-feature Pull requests containing new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option component (presentation component similar to Text, Number and Date)
1 participant