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

refactor(sbb-navigation): improve active handling #2338

Closed
jeripeierSBB opened this issue Jan 16, 2024 · 0 comments · Fixed by #2455
Closed

refactor(sbb-navigation): improve active handling #2338

jeripeierSBB opened this issue Jan 16, 2024 · 0 comments · Fixed by #2455
Assignees
Labels
complexity: M Can be done in a few days proposal: accepted
Milestone

Comments

@jeripeierSBB
Copy link
Contributor

jeripeierSBB commented Jan 16, 2024

  • Open/close state logic should be aligned between user interaction and programmatic access. If a navigation section is opened programmatically, all other open navigation sections should be closed (like when user clicks).
  • Refactor active state. We want to replace the active property with an external possibility of setting active and an internal state of being active.
    • Remove active property and apply styles via the data-active attribute.
    • Consumers can add the sbb-active css class to navigation action to mark it as active. We do not remove/change the sbb-active css class.
    • Always when opening or reopening the navigation, the navigation marker uses the sbb-active css class to apply the data-active to either true or false depending on the availability of the sbb-active css class. This implies that no state is carried over between opening, closing and reopening the navigation.
    • Clicking a navigation action should also update the active state (data-active).
    • When a first level navigation action (button, a link should not have a navigation section connected) with a connected navigation section is initially active, it should also open the navigation section.
    • If a navigation action is marked with sbb-active css class, it should receive focus (if a nested navigation section is available, the section (or fist action in section) should receive focus or if there is a navigation action with an sbb-active class within the section, the action should receive focus)
    • Check if the API for resetting the marker can be removed.
  • Remove class="sbb-navigation-marker__action" ?data-active=${action.active} in navigation-marker as it is not used. (Might already be removed.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: M Can be done in a few days proposal: accepted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants