-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] Add 'flt-semantics-identifier' attribute to semantics nodes #53278
Conversation
|
||
void _updateIdentifier() { | ||
if (semanticsObject.hasIdentifier) { | ||
setAttribute('semantics-identifier', semanticsObject.identifier!); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it would be better to prefix it with data-
?
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data-
sounds like a good idea, but only works if we move from the flt-
convention to it. For this PR, let's continue with the flt-
convention and file an issue to move to data-
(we'll also have to evaluate the pros and cons of using data attributes).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
void _updateIdentifier() { | ||
if (semanticsObject.hasIdentifier) { | ||
setAttribute('semantics-identifier', semanticsObject.identifier!); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data-
sounds like a good idea, but only works if we move from the flt-
convention to it. For this PR, let's continue with the flt-
convention and file an issue to move to data-
(we'll also have to evaluate the pros and cons of using data attributes).
…150637) flutter/engine@dda82d9...33415c6 2024-06-21 [email protected] Roll Dart SDK from 4483d67ba725 to fc1e5912fc94 (1 revision) (flutter/engine#53503) 2024-06-21 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Fix focus management for text fields (#51009)" (flutter/engine#53502) 2024-06-21 [email protected] Roll Dart SDK from 19d3e659f49a to 4483d67ba725 (2 revisions) (flutter/engine#53501) 2024-06-20 [email protected] [web] Add 'flt-semantics-identifier' attribute to semantics nodes (flutter/engine#53278) 2024-06-20 [email protected] [web] Don't add `href="#"` to semantics links (flutter/engine#53395) 2024-06-20 [email protected] Roll Dart SDK from be6b533e07e7 to 19d3e659f49a (1 revision) (flutter/engine#53495) 2024-06-20 [email protected] Roll Fuchsia Linux SDK from tD5pof7jVnbXPwP7l... to iU-B6rJxy0wUYSmmp... (flutter/engine#53493) Also rolling transitive DEPS: fuchsia/sdk/core/linux-amd64 from tD5pof7jVnbX to iU-B6rJxy0wU If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…lutter#150637) flutter/engine@dda82d9...33415c6 2024-06-21 [email protected] Roll Dart SDK from 4483d67ba725 to fc1e5912fc94 (1 revision) (flutter/engine#53503) 2024-06-21 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Fix focus management for text fields (flutter#51009)" (flutter/engine#53502) 2024-06-21 [email protected] Roll Dart SDK from 19d3e659f49a to 4483d67ba725 (2 revisions) (flutter/engine#53501) 2024-06-20 [email protected] [web] Add 'flt-semantics-identifier' attribute to semantics nodes (flutter/engine#53278) 2024-06-20 [email protected] [web] Don't add `href="#"` to semantics links (flutter/engine#53395) 2024-06-20 [email protected] Roll Dart SDK from be6b533e07e7 to 19d3e659f49a (1 revision) (flutter/engine#53495) 2024-06-20 [email protected] Roll Fuchsia Linux SDK from tD5pof7jVnbXPwP7l... to iU-B6rJxy0wUYSmmp... (flutter/engine#53493) Also rolling transitive DEPS: fuchsia/sdk/core/linux-amd64 from tD5pof7jVnbX to iU-B6rJxy0wU If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Updating the docs to reflect the change in flutter/engine#53278. `Semantics(identifier: '...')` can now be used on web to facilitate testing and DOM lookup when it comes to semantics nodes.
Hey @mdebbar The code I'm using is Semantics(
identifier: 'myid',
child: MyChild(),
), What I want to do, is to get the HTML element and prevent the default context menu on that element. |
Make
Semantics(identifier: '...')
useful on the web. This PR plugs the Semanticsidentifier
property as an HTML attributeflt-semantics-identifier
onto semantics elements.This is useful in some scenarios:
Fixes flutter/flutter#97455