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

Open
wants to merge 61 commits into
base: main
Choose a base branch
from

Conversation

victorgalo
Copy link

@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
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
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 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
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.

@chunhtai
Copy link
Contributor

Hi @victorgalo can you fix the ci so that we can merge this pr?

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

auto-submit bot commented May 16, 2024

auto label is removed for flutter/engine/41435, due to - The status or check suite Linux linux_web_engine 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 16, 2024
@chunhtai
Copy link
Contributor

Hi @victorgalo there is some analyzer warning

Analyzing web_ui...

info - lib/src/engine/semantics/semantics.dart:1659:27 - This case is covered by the previous cases. Try removing the case clause, or restructuring the preceding patterns. - unreachable_switch_case

1 issue found.

Since this have been open for a while, I can also take over if you want. let me know how you want to proceed

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

auto-submit bot commented May 17, 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.

@victorgalo
Copy link
Author

Hi @victorgalo there is some analyzer warning

Analyzing web_ui...

info - lib/src/engine/semantics/semantics.dart:1659:27 - This case is covered by the previous cases. Try removing the case clause, or restructuring the preceding patterns. - unreachable_switch_case

1 issue found.

Since this have been open for a while, I can also take over if you want. let me know how you want to proceed

Hi @chunhtai. Oh right, sorry I missed that warning after the rebase I did. Now it's fixed and I'm at the point where I was stuck, can you please help me understand why it's failing now?, I'd rather finish it myself but may need some guidance on this last step if you don't mind, sorry for the trouble!

Thank you!

@kevmoo
Copy link
Contributor

kevmoo commented May 22, 2024

Are we getting close here? I'd LOVE to get this landed.

@chunhtai chunhtai added the autosubmit Merge PR when tree becomes green via auto submit App label May 28, 2024
@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

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
8 participants