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

Fix S6825: align with React implementation #291

Merged

Conversation

@ilia-kebets-sonarsource ilia-kebets-sonarsource merged commit e9621af into master Mar 4, 2024
8 checks passed
@ilia-kebets-sonarsource ilia-kebets-sonarsource deleted the fix-S6825-not-input-hidden-only-aria-hidden branch March 4, 2024 14:16
@mshima
Copy link

mshima commented May 10, 2024

Looks like we have a few more false positives not related to this one: jhipster/generator-jhipster#26106 (comment).

Is there a public repository where we can fill a bug report?

@ericmorand-sonarsource
Copy link
Contributor

Hi @mshima, I've been looking at some of the lines that trigger the rule, like this one, and your comment on the mentioned jhipster issue:

Doesn't make sense to require keypress on aria-hidden elements that are not focusable.

I feel that the rule should not trigger because, as you say, the element is not focusable. However, I'm also not sure how the rendered HTML page would work with assistive technology: since the close action is not reachable using the keyboard (both because the element is not focusable and because of the aria-hidden attribute), how can assistive technology users close the modal?

I want to ensure that this FP doesn't fortuitously detect a pattern that may impact impaired users negatively.

Note that the mentioned line of code should trigger S6848 (Non-interactive DOM elements should not have an interactive handler).

@mshima
Copy link

mshima commented May 14, 2024

@ericmorand-sonarsource thanks for the response.

I feel that the rule should not trigger because, as you say, the element is not focusable. However, I'm also not sure how the rendered HTML page would work with assistive technology: since the close action is not reachable using the keyboard (both because the element is not focusable and because of the aria-hidden attribute), how can assistive technology users close the modal?

There is a cancel button below, so this other close 'button' is visual only.

I want to ensure that this FP doesn't fortuitously detect a pattern that may impact impaired users negatively.

Agreed.

Note that the mentioned line of code should trigger S6848 (Non-interactive DOM elements should not have an interactive handler).

That's valid.

It's a legacy code, Web:MouseEventWithoutKeyboardEquivalentCheck is a false positive in this case and doesn't justifies adding a keypress event.
S6848 is indeed an issue, that we should decide if we remove the visual only button or ignore it.

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.

4 participants