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

Add support for setting the heading level for web semantics (#97894) #41435

Merged
merged 65 commits into from
Jun 4, 2024

Conversation

victorgalo
Copy link
Contributor

@victorgalo victorgalo commented Apr 23, 2023

This change adds a new property in Semantics widget that would take an integer value corresponding to the heading levels defined by the ARIA heading role. This is necessary in order to get proper accessibility and usability in a website for users who rely on screen readers and other assistive technologies.

Issue fixed by this PR:
flutter/flutter#97894

Framework part:
flutter/flutter#125771

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides].
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See [testing the engine] for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the [CLA].
  • All existing and new tests are passing.

@flutter-dashboard flutter-dashboard bot added embedder Related to the embedder API platform-web Code specifically for the web engine labels Apr 23, 2023
@victorgalo
Copy link
Contributor Author

The build is failing because some integration tests are failing in the framework side, I need to integrate both changes together (framework and engine part) for integration tests to pass. Please, someone can tell me how I should deal with this?.

Maybe @yjbanov can shed some light?

@victorgalo victorgalo marked this pull request as ready for review April 30, 2023 18:44
@flutter-dashboard
Copy link

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

@yjbanov
Copy link
Contributor

yjbanov commented Jun 26, 2023

It's a tough one. We might have to temporarily disable the test, wait for the engine change to roll, then enable it again.

@yjbanov
Copy link
Contributor

yjbanov commented Jun 26, 2023

Would you be willing to wait for #43159 to land before landing this PR? Currently LabelAndValue is broken in that it steals the ARIA role attribute from more specific roles. After I land that, we can introduce a secondary RoleManager that would manage aria-level without touching the role attribute.

@yjbanov
Copy link
Contributor

yjbanov commented Jun 27, 2023

Update: #43159 has landed.

@yjbanov
Copy link
Contributor

yjbanov commented Jun 27, 2023

Here's what I'd recommend doing given the framework established in #43159.

  • We create a new class Heading extends RoleManager. This role manager is responsible for the aria-level attribute.
  • PrimaryRoleManager.withBasics constructor adds the Heading role manager if applicable. The Heading role is applicable if headingLevel != -1.

Alternatively, we can give the task of setting aria-level to LabelAndValue. I'm not sure if the two are orthogonal to each other 🤔

Let's keep LabelAndValue as is. In a separate PR we can fix the "header" vs "heading" vs "banner" situation.

@odrya12
Copy link

odrya12 commented Jul 26, 2023

hi there is any progress with the last checks?

@victorgalo
Copy link
Contributor Author

Here's what I'd recommend doing given the framework established in #43159.

  • We create a new class Heading extends RoleManager. This role manager is responsible for the aria-level attribute.
  • PrimaryRoleManager.withBasics constructor adds the Heading role manager if applicable. The Heading role is applicable if headingLevel != -1.

Alternatively, we can give the task of setting aria-level to LabelAndValue. I'm not sure if the two are orthogonal to each other 🤔

Let's keep LabelAndValue as is. In a separate PR we can fix the "header" vs "heading" vs "banner" situation.

Nice ideas!, thank you very much. I will create a Heading class extending RoleManager as you proposed. Sorry for my late response, I will try to implement it during this week.

# Conflicts:
#	lib/ui/semantics.dart
#	lib/web_ui/lib/src/engine/semantics/label_and_value.dart
#	lib/web_ui/lib/src/engine/semantics/semantics.dart
@github-actions github-actions bot removed the embedder Related to the embedder API label Sep 9, 2023
lib/ui/semantics.dart Outdated Show resolved Hide resolved
lib/web_ui/lib/semantics.dart Outdated Show resolved Hide resolved
lib/web_ui/lib/src/engine/semantics/heading.dart Outdated Show resolved Hide resolved
lib/web_ui/lib/src/engine/semantics/heading.dart Outdated Show resolved Hide resolved
lib/web_ui/lib/src/engine/semantics/heading.dart Outdated Show resolved Hide resolved
lib/web_ui/lib/src/engine/semantics/semantics.dart Outdated Show resolved Hide resolved
label: 'Header of the page',
transform: Matrix4.identity().toFloat64(),
rect: const ui.Rect.fromLTRB(0, 0, 100, 50),
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's also test that we can update it and clear aria-level when it's gone (assuming having the heading role without aria-level is a meaningful state).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @yjbanov, I'd say i's not a meaningful state, aria-level is required for "heading" role. Do you think I still should add it?.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nope, if it's not an expected state, we don't need to test it.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 28, 2024
Copy link
Contributor

auto-submit bot commented May 28, 2024

auto label is removed for flutter/engine/41435, due to - The status or check suite Linux Web Framework tests has failed. Please fix the issues identified (or deflake) before re-applying this label.

@goderbauer goderbauer added the autosubmit Merge PR when tree becomes green via auto submit App label May 28, 2024
Copy link
Contributor

auto-submit bot commented May 28, 2024

auto label is removed for flutter/engine/41435, due to - The status or check suite Linux Web Framework tests has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 28, 2024
@chunhtai chunhtai added the autosubmit Merge PR when tree becomes green via auto submit App label May 29, 2024
Copy link
Contributor

auto-submit bot commented May 29, 2024

auto label is removed for flutter/engine/41435, due to - The status or check suite Linux Web Framework tests has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 29, 2024
@chunhtai
Copy link
Contributor

chunhtai commented May 30, 2024

Hi @victorgalo
looks like the parameter can't be required until we migrate framework

le:///b/s/w/ir/x/w/recipe_cleanup/builder/src/out/wasm_release/flutter_web_sdk/kernel/ddc_outline_sound.dill --verbosity=error --sound-null-safety
[  +13 ms] <- compile org-dartlang-app:///main.dart
[+7088 ms] lib/src/semantics/semantics.dart:2782:23: Error: Required named parameter 'headingLevel' must be provided.
[   +1 ms]     builder.updateNode(
[        ]                       ^
[+20417 ms] "flutter test" took 34,678ms.
[   +4 ms] Failed to compile
[        ] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      WebTestCompiler._compileJS (package:flutter_tools/src/test/web_test_compiler.dart:194:7)
           <asynchronous suspension>
           #2      _FlutterTestRunnerImpl.runTests (package:flutter_tools/src/test/runner.dart:176:34)
           <asynchronous suspension>
           #3      TestCommand.runCommand (package:flutter_tools/src/commands/test.dart:585:16)
           <asynchronous suspension>
           #4      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1396:27)
           <asynchronous suspension>
           #5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #6      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:372:9)
           <asynchronous suspension>
           #8      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #9      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:308:5)
           <asynchronous suspension>
           #10     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:130:9)
           <asynchronous suspension>
           #11     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #12     main (package:flutter_tools/executable.dart:93:3)
           <asynchronous suspension>

can you update the code?

Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

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

The ci failure is bury deep in the code, It took me a while to understand it is not a flaky infra. Sorry for the delay

@@ -823,6 +835,7 @@ abstract class SemanticsUpdateBuilder {
required Int32List childrenInTraversalOrder,
required Int32List childrenInHitTestOrder,
required Int32List additionalActions,
required int headingLevel,
Copy link
Contributor

Choose a reason for hiding this comment

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

let's make this not required and give it a default value of 0

@@ -893,8 +906,13 @@ base class _NativeSemanticsUpdateBuilder extends NativeFieldWrapperClass1 implem
required Int32List childrenInTraversalOrder,
required Int32List childrenInHitTestOrder,
required Int32List additionalActions,
required int headingLevel,
Copy link
Contributor

Choose a reason for hiding this comment

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

same

@@ -283,6 +283,7 @@ class SemanticsUpdateBuilder {
required Int32List childrenInTraversalOrder,
required Int32List childrenInHitTestOrder,
required Int32List additionalActions,
required int headingLevel,
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

@chunhtai
Copy link
Contributor

chunhtai commented Jun 3, 2024

Not entirely sure why this only show up now, maybe due to merge?

Looks like you need to also modify the test class

[  +14 ms] /b/s/w/ir/x/w/recipe_cleanup/builder/src/flutter/prebuilts/linux-x64/dart-sdk/bin/dartaotruntime --disable-dart-dev /b/s/w/ir/x/w/recipe_cleanup/builder/src/flutter/prebuilts/linux-x64/dart-sdk/bin/snapshots/frontend_server_aot.dart.snapshot --sdk-root /b/s/w/ir/x/w/recipe_cleanup/builder/src/out/wasm_release/flutter_web_sdk/ --incremental --target=dartdevc --experimental-emit-debug-metadata -DDART_HHH_BOT=false -DFLUTTER_WEB_AUTO_DETECT=false -DFLUTTER_WEB_USE_SKIA=false --output-dill /b/s/w/ir/x/t/flutter_tools.PRIJQD/flutter_test.JSZLXR/out --packages /b/s/w/ir/x/w/flutter/packages/flutter/.dart_tool/package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --filesystem-root /b/s/w/ir/x/w/flutter/packages/flutter/test --filesystem-root /b/s/w/ir/x/t/flutter_tools.PRIJQD/flutter_test.JSZLXR/ --filesystem-scheme org-dartlang-app --initialize-from-dill build/45d48c4c9128ad4b2557fab909a9764a.cache.dill.track.dill --platform file:///b/s/w/ir/x/w/recipe_cleanup/builder/src/out/wasm_release/flutter_web_sdk/kernel/ddc_outline_sound.dill --verbosity=error --sound-null-safety
[  +13 ms] <- compile org-dartlang-app:///main.dart
[+2475 ms] org-dartlang-app:///semantics/semantics_update_test.dart:181:8: Error: The method 'SemanticsUpdateBuilderSpy.updateNode' has fewer named arguments than those of overridden method 'SemanticsUpdateBuilder.updateNode'.
[   +1 ms]   void updateNode({
[        ]        ^
[        ] org-dartlang-sdk:///lib/ui/semantics.dart: Context: This is the overridden method ('updateNode').
[        ] org-dartlang-app:///semantics/semantics_update_test.dart:181:8: Error: The method 'SemanticsUpdateBuilderSpy.updateNode' doesn't have the named parameter 'headingLevel' of overridden method 'SemanticsUpdateBuilder.updateNode'.
[        ]   void updateNode({
[        ]        ^
[        ] org-dartlang-sdk:///lib/ui/semantics.dart: Context: This is the overridden method ('updateNode').
[+24591 ms] "flutter test" took 33,553ms.
[   +3 ms] Failed to compile
[        ] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      WebTestCompiler._compileJS (package:flutter_tools/src/test/web_test_compiler.dart:194:7)
           <asynchronous suspension>
           #2      _FlutterTestRunnerImpl.runTests (package:flutter_tools/src/test/runner.dart:176:34)
           <asynchronous suspension>
           #3      TestCommand.runCommand (package:flutter_tools/src/commands/test.dart:585:16)
           <asynchronous suspension>
           #4      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1396:27)
           <asynchronous suspension>
           #5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #6      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:372:9)
           <asynchronous suspension>
           #8      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #9      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:308:5)
           <asynchronous suspension>
           #10     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:130:9)
           <asynchronous suspension>
           #11     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #12     main (package:flutter_tools/executable.dart:93:3)
           <asynchronous suspension>

@chunhtai
Copy link
Contributor

chunhtai commented Jun 3, 2024

and here as well

 info - scenario_app/lib/src/locale_initialization.dart:81:23 - The value of the argument is redundant because it matches the default value. Try removing the argument. - avoid_redundant_argument_values
   info - scenario_app/lib/src/locale_initialization.dart:141:23 - The value of the argument is redundant because it matches the default value. Try removing the argument. - avoid_redundant_argument_values

@chunhtai
Copy link
Contributor

chunhtai commented Jun 4, 2024

no worry I can fix this from my side

auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jun 4, 2024
…49671)

The pr flutter/engine#41435 adds a new property into updateNode. 

The pr migrate the method in framework first to unblock the engine pr
@chunhtai chunhtai added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 4, 2024
@auto-submit auto-submit bot merged commit 11a32d4 into flutter:main Jun 4, 2024
31 checks passed
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jun 5, 2024
…149699)

flutter/engine@e884690...11a32d4

2024-06-04 vtrgalo@gmail.com Add support for setting the heading level for web semantics (#97894) (flutter/engine#41435)
2024-06-04 skia-flutter-autoroll@skia.org Roll Dart SDK from 2d7d6facc2b4 to 343c20614708 (2 revisions) (flutter/engine#53203)

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 matanl@google.com,rmistry@google.com,zra@google.com 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
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jun 6, 2024
…125771)

This change adds a new property in Semantics widget that would take an integer corresponding to the heading levels defined by the ARIA heading role. This is necessary in order to get proper accessibility and usability in a website for users who rely on screen readers and other assistive technologies.

Issue fixed by this PR:
fixes #97894

Engine part:
flutter/engine#41435
@victorgalo
Copy link
Contributor Author

no worry I can fix this from my side
Thank you @chunhtai !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-web Code specifically for the web engine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants