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

ActiveDescendentController #2770

Closed
bennypowers opened this issue Jun 10, 2024 · 3 comments
Closed

ActiveDescendentController #2770

bennypowers opened this issue Jun 10, 2024 · 3 comments
Labels
accessibility Improve accessibility feature New feature or request priority: medium Severity level: 2

Comments

@bennypowers
Copy link
Member

bennypowers commented Jun 10, 2024

Description of the requested feature

The RovingTabindexController helps component authors to implement the RTI pattern for compound elements like select menu / dropdown, tabs, accordion, etc. We have identified the need to implement the alternative active descendant pattern in the case of typeahead select.

In shadow DOM scenarios, this pattern will require some quite complicated workarounds to the cross-root aria problem.

Impacted component(s)

  • pf-select with typeaheadmulti variant

Some previous work laid some conceptual foundations and guardrails. See for example

switch (this.variant) {
// TODO
// case 'typeahead':
// case 'typeaheadmulti':
// this.#controller = new ListboxController.of<PfOption>(this, {
// multi: this.variant==='typeaheadmulti',
// a11yController: ActiveDescendantController.of(this)
// });
// break;

It seems like the ActiveDescendentController will need to either copy the slotted options into the shadowroot, or require the input and buttons to be in the light dom.

At large, the ActiveDescendentController should be able to be used as a "drop-in" replacement for RTIC. I put "drop in" in quote marks, though, because clearly some additional work may be required.

Related issues

CC @adamjohnson for initial review of approach sketched here
CC @Arathy-s as well, with thanks for taking an interest in this project

@bennypowers bennypowers added feature New feature or request accessibility Improve accessibility priority: medium Severity level: 2 labels Jun 10, 2024
@adamjohnson
Copy link
Collaborator

Any controller that helps simplify developers' lives is going to be a win.

That said, I have a few questions / thoughts:

Feasibility and Complexity

1. Current Complexities of Cross-root ARIA:

  • Given the intricate nature of cross-root ARIA, do you think implementing this controller is premature? We need to evaluate if the benefits outweigh the complexities at this stage (ala "lift and shift" and lightdom implementations).

2. Future Maintenance and Business Priorities:

  • When cross-root ARIA matures, will this implementation need significant rework? If yes, we should consider if this aligns with our long-term business priorities.
    • Could we potentially use the development time more effectively on building other components?

Developer Demand and Alternatives

3. Demand and Use Cases:

  • Is there substantial demand from developers for this controller? Do we adequately understand their needs and pain points?
  • Are there common scenarios where the native <datalist> element could suffice? If the majority of use cases can be addressed by native elements, the need for this custom controller might be reduced.
    • If this is the case, perhaps we make a dedicated <datalist> component or pattern.

Looking forward to everyone's input. 👍

@bennypowers
Copy link
Member Author

premature? ... "lift and shift"

It's not ideal, no, but there is precedent in other design systems.

When cross-root ARIA matures, will this implementation need significant rework?

Yes, but... if we do this right, then we will not have to change any public apis at that point.

Could we potentially use the development time more effectively on building other components?

The back log is long, true, but...

Is there substantial demand from developers for this controller? Do we adequately understand their needs and pain points?

Yes, combobox is one of my most commonly requested features, and I just don't think we can do it without active descendent

native <datalist> element could suffice?

Interesting suggestion, how might that work? Would we still be able to implement reference targets as a solution to x-root aria once it lands, without having to change public apis? What about styling, could we include rich content (like items with description, icons, etc) in list items?


  • Stage 0 (now): we can't do combobox b/c of cross-root aria
  • Stage 1: We implement an ActiveDescendentController which works by copying nodes into the shadow root
  • Stage 2 (after reference target lands): we refactor the internal guts of ActiveDescendentController to no longer copy nodes, but use reference targets instead

@adamjohnson
Copy link
Collaborator

Yes, combobox is one of my most commonly requested features, and I just don't think we can do it without active descendent

Good to know. 👍

native <datalist> element could suffice? ... Would we still be able to...

AFAICT, we still can't add additional HTML inside an <option> (icons, descriptions), so using <datalist> sounds like it's not going to work in this instance.

Your Stage 0-2 roadmap sounds like the way forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility Improve accessibility feature New feature or request priority: medium Severity level: 2
Projects
None yet
Development

No branches or pull requests

2 participants