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

Refactor setFocus methods for consistency #10454

Open
1 of 5 tasks
driskull opened this issue Sep 30, 2024 · 0 comments
Open
1 of 5 tasks

Refactor setFocus methods for consistency #10454

driskull opened this issue Sep 30, 2024 · 0 comments
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.

Comments

@driskull
Copy link
Member

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

@Method()
async setFocus(): Promise<void> {
await componentFocusable(this);
this.el.focus();
}

Calcite package

  • @esri/calcite-components
  • @esri/calcite-components-angular
  • @esri/calcite-components-react
  • @esri/calcite-design-tokens
  • @esri/eslint-plugin-calcite-components
@driskull driskull added refactor Issues tied to code that needs to be significantly reworked. 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels Sep 30, 2024
@github-actions github-actions bot added the calcite-components Issues specific to the @esri/calcite-components package. label Sep 30, 2024
@macandcheese macandcheese added p - medium Issue is non core or affecting less that 60% of people using the library estimate - 8 Requires input from team, consider smaller steps. labels Feb 25, 2025
@DitwanP DitwanP added needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. and removed needs triage Planning workflow - pending design/dev review. labels Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

3 participants