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

[web] Set the correct href on semantic links #52720

Closed
wants to merge 3 commits into from

Conversation

mdebbar
Copy link
Contributor

@mdebbar mdebbar commented May 10, 2024

  • Use the semantics value as the href attribute for links.
  • Omit the href attribute when value is empty (prevents unwanted navigation).
  • For links and incrementables, do not derive the label attribute from the semantics value.

Part of flutter/flutter#102535
Fixes flutter/flutter#146291

@github-actions github-actions bot added the platform-web Code specifically for the web engine label May 10, 2024
// https://github.com/flutter/flutter/issues/102535.
element.setAttribute('href', '#');
// TODO: The <a> element has `aria-label={value}`. We should stop that!
element.setAttribute('href', semanticsObject.hasValue ? semanticsObject.value! : '#');
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is going to use value as href, then this role manager should not use the withBasics super constructor, because that one adds the LabelAndValue role which includes value in the label. Alternatively, we can make LabelAndValue configurable so it does not include value in some cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed it by introducing an allowlist labelSources (also used it for incrementable, which was hardcoded as a one-off case).

@kevmoo
Copy link
Contributor

kevmoo commented Jul 9, 2024

Was this superceded by #53507 ?

@kevmoo kevmoo closed this Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-web Code specifically for the web engine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clicking on a link in a Flutter Web page using an accessibility service causes the page to reload
3 participants