patternfly / patternfly-elements

PatternFly Elements. A set of community-created web components based on PatternFly design.
https://patternflyelements.org/
MIT License
375 stars 85 forks source link

ActiveDescendentController #2770

Open bennypowers opened 3 weeks ago

bennypowers commented 3 weeks ago

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)

Some previous work laid some conceptual foundations and guardrails. See for example https://github.com/patternfly/patternfly-elements/blob/75c54410a6a2ac033a2d81ba3cac1f5a64c3e6ec/elements/pf-select/pf-select.ts#L336-L344

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

adamjohnson commented 2 weeks ago

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:

2. Future Maintenance and Business Priorities:

Developer Demand and Alternatives

3. Demand and Use Cases:

Looking forward to everyone's input. 👍

bennypowers commented 2 weeks ago

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?


adamjohnson commented 2 weeks ago

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.