Replies: 1 comment 1 reply
-
fewer elements is nice |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is sort of a loaded topic that I've been debating in my head for a while trying to figure out the "best" answer for my particular use case. The goal in building
rh-secondary-nav
was to have the Light DOM be as semantic, accessible, and critical stylable ( is that even a term? 🙃 ) from the start as it is above the fold critical page functionality. This included using thenav
element at the root nav slot of the component.Example structure:
After building out the component, and watching
rh-footer
evolve, I can't escape the wonder if my original approach may be overkill? Could the structure be simplified to:Whereas the shadow dom takes care of adding the
nav
element on upgrade and subsequently removing arole="navigation"
attribute that is only there in case of a failed upgrade to maintain accessibility semantics.All while being keenly aware of:
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/navigation_role
This structure is currently being utilized in
rh-footer
whereas the<footer>
tag is embedded in the shadow dom. I also wonder if it should implement therole="contentinfo"
on its host tag and remove it on upgrade?https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/contentinfo_role
This change would also help to reduce the need for the container component which was really just an area to apply additional slots. Overall reducing the custom tags needed in the light DOM.
What are we defining as the best practice here? Keeping in mind accessibility is the
#1
concern then critical styles then finally FED DX.A potential CSS issue with the refactor approach could be the need to "restyle" the layout in the critical light DOM CSS from a grid on the
rh-secondary-nav
tag to a grid on the shadow dom.container
class after upgrade. I would have to experiment to see if that would cause any reflow issues.Beta Was this translation helpful? Give feedback.
All reactions