Skip to content

Conversation

xIrusux
Copy link
Contributor

@xIrusux xIrusux commented Sep 29, 2025

Changes in this pull request

Resolves #2141

Additional info

This pull request introduces enhancements to focus management in the filter sidebar, improving accessibility and user experience when interacting with dynamic field filters. The main changes involve adding a context-based focus restoration mechanism and refactoring several filter components to utilize it. Additionally, updates were made to ensure data is set immediately on text and textarea filter changes.

Focus Management Improvements:

  • Introduced a new FocusProvider and useFocusRestore context in focus-context.tsx to centralize and simplify focus restoration logic across filter components. ([assets/js/src/core/modules/element/listing/decorators/general-filters/view-layer/components/sidebar/tabs/filters/focus-context.tsxR1-R38](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-fa32b2bcb106ca1d9efa4cb4c77975b67e4914ac86354aebc8e71df990d6286fR1-R38))
  • Wrapped the filter sidebar content in FilterContainerInner with FocusProvider, and added logic to restore focus to the sidebar container when appropriate (e.g., after applying filters or pressing Enter). ([[1]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-2b881fc01f1312a9b40f0f9b5b0af369cd38df35996342404807d70b36410052R39-R43), [[2]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-2b881fc01f1312a9b40f0f9b5b0af369cd38df35996342404807d70b36410052R88-R98), [[3]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-2b881fc01f1312a9b40f0f9b5b0af369cd38df35996342404807d70b36410052R119-R127), [[4]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-2b881fc01f1312a9b40f0f9b5b0af369cd38df35996342404807d70b36410052R187-R189))
  • Updated FieldFiltersContainer to restore focus when the number of filters increases, improving keyboard navigation and accessibility. ([[1]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-2dd1ca3104fec4ab0724f56c12d8db6f270231a8c0f2c36eff5acbe8adffb2daR23), [[2]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-2dd1ca3104fec4ab0724f56c12d8db6f270231a8c0f2c36eff5acbe8adffb2daR32), [[3]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-2dd1ca3104fec4ab0724f56c12d8db6f270231a8c0f2c36eff5acbe8adffb2daR51), [[4]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-2dd1ca3104fec4ab0724f56c12d8db6f270231a8c0f2c36eff5acbe8adffb2daR68-R74))

Component Refactoring for Focus Restoration:

  • Refactored boolean select, date picker, and multiselect filter components to use useFocusRestore, restoring sidebar focus when dropdowns close. ([[1]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-dcbabd445dfdfc3ae638ed81dd12dc3c70dc1f4ec60a8c6c47c9e5eb23b36de5R15), [[2]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-dcbabd445dfdfc3ae638ed81dd12dc3c70dc1f4ec60a8c6c47c9e5eb23b36de5R45), [[3]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-dcbabd445dfdfc3ae638ed81dd12dc3c70dc1f4ec60a8c6c47c9e5eb23b36de5R80), [[4]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-86cb4acb9f4d7262f78cb9387a9cbe1b9aa4dcdf086aa023131088e183ef9736R20), [[5]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-86cb4acb9f4d7262f78cb9387a9cbe1b9aa4dcdf086aa023131088e183ef9736R42), [[6]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-86cb4acb9f4d7262f78cb9387a9cbe1b9aa4dcdf086aa023131088e183ef9736R110-R112), [[7]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-86cb4acb9f4d7262f78cb9387a9cbe1b9aa4dcdf086aa023131088e183ef9736R156), [[8]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-86cb4acb9f4d7262f78cb9387a9cbe1b9aa4dcdf086aa023131088e183ef9736R177), [[9]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-108afc58132b0e7861ea4732f261f17ee5ed67dbdef7c2c70d68c363672625d1R15), [[10]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-108afc58132b0e7861ea4732f261f17ee5ed67dbdef7c2c70d68c363672625d1R29), [[11]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-108afc58132b0e7861ea4732f261f17ee5ed67dbdef7c2c70d68c363672625d1R60))

Immediate Data Setting in Text Filters:

  • Changed text and textarea filter components to set filter data immediately on change, removing the need for blur event handlers and simplifying state management. ([[1]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-9ad6a7730b5da23e4e67d4c4d1dfa7fc0539ae6f7f5b1d7038e2643acc83ed8bL32-L40), [[2]](https://github.com/pimcore/studio-ui-bundle/pull/2143/files#diff-fc7b1866153cd9327cf6cf65c3ceac387aa924c5a6e1cd760b6e1dea301cc06dL28-L37))

These changes collectively improve the accessibility and usability of the filter sidebar, especially for keyboard users and those relying on assistive technologies.

@xIrusux xIrusux self-assigned this Sep 29, 2025
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Global] - behaviour of "Enter" i.e. for applying

1 participant