fix: role for aside element when nested within sectioning content#30
fix: role for aside element when nested within sectioning content#30drwpow merged 2 commits intodrwpow:mainfrom jlp-craigmorten:fix-aside-inside-landmark-role
Conversation
🦋 Changeset detectedLatest commit: 9d45089 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
I don’t mind this. I see this as more of a “private” API that can remain undocumented. I think just to be safe I’d err on the side of not exporting it from the entry so we could always refactor later if needed.
Ha I usually wait till way past 3 to refactor, until it’s fairly obvious. |
Changes
Relates to #25
Updates the role returned for a
asideelement to be either:complementarywhen the element is named;complementarywhen the element is not nested within sectioning content;genericotherwise.This detail is currently missing from the HTML-ARIA spec, but is describe in the sibling HTML-AAM spec:
bodyormain(i.e. not sectioning content)How to Review
Mirrors the existing functionality and tests for combination of the
imgelement which has similar named behaviours, and thefooterwhich has similar scoping/nesting behaviours.Undecided whether would be cleaner to scope the
calculateAccessibleName()check within the newgetAsideRole()- perhaps feels a bit awkward to have agetAsideRole()that holds partial logic for getting the role, the rest living elsewhere 🤔 wdyt?Starting to see patterns arising, e.g.
attributes['aria-label'] || attributes['aria-labelledby']repeated, but perhaps still borderline rule or 3 to warrant refactoring at this stage?Checklist