Refactor setFocus methods for consistency #10454
Labels
0 - new
New issues that need assignment.
calcite-components
Issues specific to the @esri/calcite-components package.
estimate - 8
Requires input from team, consider smaller steps.
needs milestone
Planning workflow - pending milestone assignment, has priority and/or estimate.
p - medium
Issue is non core or affecting less that 60% of people using the library
refactor
Issues tied to code that needs to be significantly reworked.
Description
Our component setFocus methods are inconsistent. Some focus on the first focusable element (ideal), however some just focus on the host element even if the host element isn't focusable.
We should clean up our setFocus methods for constency.
I propose we have a shared method (controller?) or a protected method for all focusable components.
This default method would call
focusFirstTabbable(this.el)
and focus on the first focusable element by default.Proposed Advantages
This would promote consistency. The few components that need to do some different focus work could override this protected method or controller to handle unique use cases.
Which Component
All
Relevant Info
calcite-design-system/packages/calcite-components/src/components/menu/menu.tsx
Lines 145 to 149 in 12f1476
Calcite package
The text was updated successfully, but these errors were encountered: