Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion platforms/atspi-common/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,10 @@ impl NodeWrapper<'_> {
self.0.braille_role_description()
}

fn keyboard_shortcut(&self) -> Option<&str> {
self.0.data().keyboard_shortcut()
Copy link
Member

Choose a reason for hiding this comment

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

We have dedicated getters to Node for each property in the consumer crate, please add a new one.

}

fn attributes(&self) -> HashMap<&'static str, String> {
let mut attributes = HashMap::new();
if let Some(placeholder) = self.placeholder() {
Expand All @@ -399,6 +403,9 @@ impl NodeWrapper<'_> {
if let Some(role_description) = self.braille_role_description() {
attributes.insert("brailleroledescription", role_description.to_string());
}
if let Some(shortcut) = self.keyboard_shortcut() {
attributes.insert("keyshortcuts", shortcut.to_string());
}

attributes
}
Expand Down Expand Up @@ -959,7 +966,12 @@ impl PlatformNode {
actions.push(AtspiAction {
localized_name: wrapper.get_action_name(i as i32),
description: "".into(),
key_binding: "".into(),
// The keyboard shortcut is for the default action (index 0)
key_binding: if i == 0 {
wrapper.keyboard_shortcut().unwrap_or_default().into()
} else {
"".into()
},
});
}
Ok(actions)
Expand Down