Skip to content

[Accessibility] fix: Set focus to form when applying filters#11397

Open
abrahammordev wants to merge 1 commit intoILIAS-eLearning:release_10from
surlabs:ilias10_a11y_32498
Open

[Accessibility] fix: Set focus to form when applying filters#11397
abrahammordev wants to merge 1 commit intoILIAS-eLearning:release_10from
surlabs:ilias10_a11y_32498

Conversation

@abrahammordev
Copy link
Copy Markdown
Contributor

Set focus to form when applying filters

When a user applies filters in the Mail folder view, the page reloads and focus is lost, forcing keyboard and screen reader users to navigate back to the filter area manually. This fix restores focus to the first interactive element in the filter section after the apply action.

Changes:

  • Added an optional $focus_first_filter_input_after_apply flag to MailFilterUI, defaulting to false to preserve existing behaviour.
  • ilMailFolderGUI::shouldFocusFirstFilterInputAfterApply() detects whether the current request was triggered by the filter's apply command (ilUIFilterService::CMD_APPLY) and passes the flag accordingly.

No behavioural change occurs on regular page loads or other filter commands.

Related
https://mantis.ilias.de/view.php?id=32498

@abrahammordev abrahammordev added php Pull requests that update Php code accessibility Pull requests that propose A11Y changes. labels Apr 7, 2026
@mjansenDatabay
Copy link
Copy Markdown
Contributor

Hi @abrahammordev, hi all,

first of all, thank you @abrahammordev for your contribution and the effort you put into this.

However, in my opinion, we should not accept this PR. Here is my reasoning:

  • Although the Mantis issue was filed for an accessibility problem in the "Mail" component, the underlying issue appears to be a general one.
  • The view in question is a composition of two UI elements: a data table and a filter. There are dozens of views across ILIAS where filters are placed above a table.
  • The approach taken in this PR introduces local changes specific to the "Mail" component rather than providing a general solution for what is fundamentally a general problem.
  • The PR adds JavaScript directly to the PHP code of the "Mail" component, relying on a specific DOM structure and particular attributes on certain elements. This is inherently fragile, since the rendered HTML is not under the control of the "Mail" component.
  • Instead, we should aim for a general solution within the UI components themselves.

Best regards,
Michael

@abrahammordev
Copy link
Copy Markdown
Contributor Author

Hi @mjansenDatabay,

Thank you very much for your review, I really appreciate it!
Regarding your suggestion, you are absolutely right — I should have addressed the issue in a more general way.
Perhaps we could get @thibsy's opinion on how to best approach the fix.

I think a FR might be required here, as I would not want to add unnecessary complexity to the UI components themselves, and this seems to go beyond a pure a11y issue — it looks more like a general UI improvement.

Many thanks,
Abraham

Copy link
Copy Markdown
Contributor

@thibsy thibsy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi all,

I agree with @mjansenDatabay that we should not implement a fix local to every usage. The only place where this is be possible for now is the ilUIFilterService though (maybe in handleApplyAndToggle() as kind of hook), which should be used for most cases.

I think could implement a better solution and use a similar mechanism like for the data-table, in which a fixed ID for session storage can be provided and the UI framework does its thing. However, this would require effort which is better spent towards refactoring the filters as a whole (they suck). So my direction would be to try and apply the bandaid above.

IMO we can still treat this as an A11Y issue rather than a general UI improvement. I also think we do not need a FR or similar for this, as this is an implementation detail (a very intrusive one though).

Kind regards,
@thibsy (as UI coordinator)

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

Labels

accessibility Pull requests that propose A11Y changes. bugfix php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants