@@ -96,11 +96,10 @@ impl NodeWrapper<'_> {
96
96
Role :: Abbr => UIA_TextControlTypeId ,
97
97
Role :: Alert => UIA_TextControlTypeId ,
98
98
Role :: AlertDialog => {
99
- // Chromium's implementation suggests the use of
100
- // UIA_TextControlTypeId, not UIA_PaneControlTypeId, because some
101
- // Windows screen readers are not compatible with
102
- // Role::AlertDialog yet.
103
- UIA_TextControlTypeId
99
+ // Documentation suggests the use of UIA_PaneControlTypeId,
100
+ // but Chromium's implementation uses UIA_WindowControlTypeId
101
+ // instead.
102
+ UIA_WindowControlTypeId
104
103
}
105
104
Role :: Application => UIA_PaneControlTypeId ,
106
105
Role :: Article => UIA_GroupControlTypeId ,
@@ -123,7 +122,12 @@ impl NodeWrapper<'_> {
123
122
Role :: DescriptionListDetail => UIA_TextControlTypeId ,
124
123
Role :: DescriptionListTerm => UIA_ListItemControlTypeId ,
125
124
Role :: Details => UIA_GroupControlTypeId ,
126
- Role :: Dialog => UIA_PaneControlTypeId ,
125
+ Role :: Dialog => {
126
+ // Documentation suggests the use of UIA_PaneControlTypeId,
127
+ // but Chromium's implementation uses UIA_WindowControlTypeId
128
+ // instead.
129
+ UIA_WindowControlTypeId
130
+ }
127
131
Role :: Directory => UIA_ListControlTypeId ,
128
132
Role :: DisclosureTriangle => UIA_ButtonControlTypeId ,
129
133
Role :: Document | Role :: Terminal => UIA_DocumentControlTypeId ,
@@ -261,6 +265,17 @@ impl NodeWrapper<'_> {
261
265
self . 0 . role_description ( )
262
266
}
263
267
268
+ fn aria_role ( & self ) -> Option < & str > {
269
+ match self . 0 . role ( ) {
270
+ Role :: AlertDialog => Some ( "alertdialog" ) ,
271
+ Role :: Dialog => Some ( "dialog" ) ,
272
+ _ => {
273
+ // TODO: Expose more ARIA roles.
274
+ None
275
+ }
276
+ }
277
+ }
278
+
264
279
pub ( crate ) fn name ( & self ) -> Option < WideString > {
265
280
let mut result = WideString :: default ( ) ;
266
281
if self . 0 . label_comes_from_value ( ) {
@@ -443,6 +458,18 @@ impl NodeWrapper<'_> {
443
458
self . 0 . role ( ) == Role :: PasswordInput
444
459
}
445
460
461
+ fn is_dialog ( & self ) -> bool {
462
+ self . 0 . is_dialog ( )
463
+ }
464
+
465
+ fn is_window_pattern_supported ( & self ) -> bool {
466
+ self . 0 . is_dialog ( )
467
+ }
468
+
469
+ fn is_modal ( & self ) -> bool {
470
+ self . 0 . is_modal ( )
471
+ }
472
+
446
473
pub ( crate ) fn enqueue_property_changes (
447
474
& self ,
448
475
queue : & mut Vec < QueuedEvent > ,
@@ -501,7 +528,8 @@ impl NodeWrapper<'_> {
501
528
IRangeValueProvider ,
502
529
ISelectionItemProvider ,
503
530
ISelectionProvider ,
504
- ITextProvider
531
+ ITextProvider ,
532
+ IWindowProvider
505
533
) ]
506
534
pub ( crate ) struct PlatformNode {
507
535
pub ( crate ) context : Weak < Context > ,
@@ -948,6 +976,7 @@ macro_rules! patterns {
948
976
properties ! {
949
977
( UIA_ControlTypePropertyId , control_type) ,
950
978
( UIA_LocalizedControlTypePropertyId , localized_control_type) ,
979
+ ( UIA_AriaRolePropertyId , aria_role) ,
951
980
( UIA_NamePropertyId , name) ,
952
981
( UIA_FullDescriptionPropertyId , description) ,
953
982
( UIA_HelpTextPropertyId , placeholder) ,
@@ -963,7 +992,8 @@ properties! {
963
992
( UIA_IsRequiredForFormPropertyId , is_required) ,
964
993
( UIA_IsPasswordPropertyId , is_password) ,
965
994
( UIA_PositionInSetPropertyId , position_in_set) ,
966
- ( UIA_SizeOfSetPropertyId , size_of_set)
995
+ ( UIA_SizeOfSetPropertyId , size_of_set) ,
996
+ ( UIA_IsDialogPropertyId , is_dialog)
967
997
}
968
998
969
999
patterns ! {
@@ -1103,6 +1133,41 @@ patterns! {
1103
1133
}
1104
1134
} )
1105
1135
}
1136
+ ) ) ,
1137
+ ( UIA_WindowPatternId , IWindowProvider , IWindowProvider_Impl , is_window_pattern_supported, (
1138
+ ( UIA_WindowIsModalPropertyId , IsModal , is_modal, BOOL )
1139
+ ) , (
1140
+ fn SetVisualState ( & self , _: WindowVisualState ) -> Result <( ) > {
1141
+ Err ( invalid_operation( ) )
1142
+ } ,
1143
+
1144
+ fn Close ( & self ) -> Result <( ) > {
1145
+ Err ( not_supported( ) )
1146
+ } ,
1147
+
1148
+ fn WaitForInputIdle ( & self , _: i32 ) -> Result <BOOL > {
1149
+ Err ( not_supported( ) )
1150
+ } ,
1151
+
1152
+ fn CanMaximize ( & self ) -> Result <BOOL > {
1153
+ Err ( not_supported( ) )
1154
+ } ,
1155
+
1156
+ fn CanMinimize ( & self ) -> Result <BOOL > {
1157
+ Err ( not_supported( ) )
1158
+ } ,
1159
+
1160
+ fn WindowVisualState ( & self ) -> Result <WindowVisualState > {
1161
+ Err ( not_supported( ) )
1162
+ } ,
1163
+
1164
+ fn WindowInteractionState ( & self ) -> Result <WindowInteractionState > {
1165
+ Ok ( WindowInteractionState_ReadyForUserInteraction )
1166
+ } ,
1167
+
1168
+ fn IsTopmost ( & self ) -> Result <BOOL > {
1169
+ Err ( not_supported( ) )
1170
+ }
1106
1171
) )
1107
1172
}
1108
1173
0 commit comments