Skip to content

feat: Add author_id property#424

Merged
mwcampbell merged 2 commits into
mainfrom
author_id
Jun 9, 2024
Merged

feat: Add author_id property#424
mwcampbell merged 2 commits into
mainfrom
author_id

Conversation

@DataTriny

@DataTriny DataTriny commented Jun 2, 2024

Copy link
Copy Markdown
Member

Adds a new optional author_id property, useful primarily for QA.

  • On Unix: the purpose of the AccessibleId property have been clarified since I wrote the adapter. These changes make it behave like GTK4.
  • On macOS: I haven't really found other implementations of this property, but Apple documentation indicates that accessibilityIdentifier is intended for this.

Tested on Windows and Linux by modifying the mixed_handlers example like so:

diff --git a/platforms/winit/examples/mixed_handlers.rs b/platforms/winit/examples/mixed_handlers.rs
index 00281e2..7c1e68f 100644
--- a/platforms/winit/examples/mixed_handlers.rs
+++ b/platforms/winit/examples/mixed_handlers.rs
@@ -43,8 +43,14 @@ fn build_button(id: NodeId, name: &str) -> Node {
         BUTTON_2_ID => BUTTON_2_RECT,
         _ => unreachable!(),
     };
+    let author_id = match id {
+        BUTTON_1_ID => "button1",
+        BUTTON_2_ID => "button2",
+        _ => unreachable!(),
+    };

     let mut builder = NodeBuilder::new(Role::Button);
+    builder.set_author_id(author_id);
     builder.set_bounds(rect);
     builder.set_name(name);
     builder.add_action(Action::Focus);

@mwcampbell

Copy link
Copy Markdown
Contributor

Please add a dummy change to platforms/winit/Cargo.toml (add or remove a blank line at the bottom), as we've done before, to force a semver-breaking bump to that crate, since we're doing such a bump to the accesskit crate. Then this will be ready to merge.

@mwcampbell
mwcampbell merged commit 0d1c56f into main Jun 9, 2024
@mwcampbell
mwcampbell deleted the author_id branch June 9, 2024 17:41
@mwcampbell mwcampbell mentioned this pull request Jun 9, 2024
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.

2 participants