Skip to content

Commit 46ed99b

Browse files
authored
feat: Expose the is_required property (#497)
1 parent a86901d commit 46ed99b

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

consumer/src/node.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,10 @@ impl<'a> Node<'a> {
609609
)
610610
}
611611

612+
pub fn is_required(&self) -> bool {
613+
self.data().is_required()
614+
}
615+
612616
pub fn live(&self) -> Live {
613617
self.data()
614618
.live()

platforms/atspi-common/src/node.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,9 @@ impl NodeWrapper<'_> {
294294
if state.is_focusable() {
295295
atspi_state.insert(State::Focusable);
296296
}
297+
if state.is_required() {
298+
atspi_state.insert(State::Required);
299+
}
297300
if let Some(orientation) = state.orientation() {
298301
atspi_state.insert(if orientation == Orientation::Horizontal {
299302
State::Horizontal

platforms/macos/src/node.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,12 @@ declare_class!(
807807
});
808808
}
809809

810+
#[method(isAccessibilityRequired)]
811+
fn is_required(&self) -> bool {
812+
self.resolve(|node| node.is_required())
813+
.unwrap_or(false)
814+
}
815+
810816
#[method(isAccessibilitySelectorAllowed:)]
811817
fn is_selector_allowed(&self, selector: Sel) -> bool {
812818
self.resolve(|node| {
@@ -860,6 +866,7 @@ declare_class!(
860866
|| selector == sel!(accessibilityValue)
861867
|| selector == sel!(accessibilityMinValue)
862868
|| selector == sel!(accessibilityMaxValue)
869+
|| selector == sel!(isAccessibilityRequired)
863870
|| selector == sel!(accessibilityOrientation)
864871
|| selector == sel!(isAccessibilityElement)
865872
|| selector == sel!(isAccessibilityFocused)

platforms/windows/src/node.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,10 @@ impl NodeWrapper<'_> {
374374
.unwrap_or_else(|| self.numeric_value_step())
375375
}
376376

377+
fn is_required(&self) -> bool {
378+
self.0.is_required()
379+
}
380+
377381
fn is_selection_item_pattern_supported(&self) -> bool {
378382
match self.0.role() {
379383
// TODO: tables (#29)
@@ -885,7 +889,8 @@ properties! {
885889
(LiveSetting, live_setting),
886890
(AutomationId, automation_id),
887891
(ClassName, class_name),
888-
(Orientation, orientation)
892+
(Orientation, orientation),
893+
(IsRequiredForForm, is_required)
889894
}
890895

891896
patterns! {

0 commit comments

Comments
 (0)