MCPcopy Create free account
hub / github.com/AccessKit/accesskit / role

Method role

platforms/atspi-common/src/node.rs:87–295  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

85 }
86
87 pub(crate) fn role(&self) -> AtspiRole {
88 if self.0.has_role_description() {
89 return AtspiRole::Extended;
90 }
91
92 match self.0.role() {
93 Role::Alert => AtspiRole::Notification,
94 Role::AlertDialog => AtspiRole::Alert,
95 Role::Comment | Role::Suggestion => AtspiRole::Section,
96 // TODO: See how to represent ARIA role="application"
97 Role::Application => AtspiRole::Embedded,
98 Role::Article => AtspiRole::Article,
99 Role::Audio => AtspiRole::Audio,
100 Role::Banner | Role::Header => AtspiRole::Landmark,
101 Role::Blockquote => AtspiRole::BlockQuote,
102 Role::Caret => AtspiRole::Unknown,
103 Role::Button => {
104 if self.0.toggled().is_some() {
105 AtspiRole::ToggleButton
106 } else {
107 AtspiRole::Button
108 }
109 }
110 Role::DefaultButton => AtspiRole::Button,
111 Role::Canvas => AtspiRole::Canvas,
112 Role::Caption => AtspiRole::Caption,
113 Role::Cell | Role::GridCell => AtspiRole::TableCell,
114 Role::CheckBox => AtspiRole::CheckBox,
115 Role::Switch => AtspiRole::ToggleButton,
116 Role::ColorWell => AtspiRole::Button,
117 Role::ColumnHeader => AtspiRole::ColumnHeader,
118 Role::ComboBox | Role::EditableComboBox => AtspiRole::ComboBox,
119 Role::Complementary => AtspiRole::Landmark,
120 Role::ContentDeletion => AtspiRole::ContentDeletion,
121 Role::ContentInsertion => AtspiRole::ContentInsertion,
122 Role::ContentInfo | Role::Footer => AtspiRole::Landmark,
123 Role::Definition => AtspiRole::DescriptionValue,
124 Role::DescriptionList => AtspiRole::DescriptionList,
125 Role::Details => AtspiRole::Panel,
126 Role::Dialog => AtspiRole::Dialog,
127 Role::DisclosureTriangle => AtspiRole::ToggleButton,
128 Role::DocCover => AtspiRole::Image,
129 Role::DocBackLink | Role::DocBiblioRef | Role::DocGlossRef | Role::DocNoteRef => {
130 AtspiRole::Link
131 }
132 Role::DocBiblioEntry | Role::DocEndnote => AtspiRole::ListItem,
133 Role::DocNotice | Role::DocTip => AtspiRole::Comment,
134 Role::DocFootnote => AtspiRole::Footnote,
135 Role::DocPageBreak => AtspiRole::Separator,
136 Role::DocPageFooter => AtspiRole::Footer,
137 Role::DocPageHeader => AtspiRole::Header,
138 Role::DocAcknowledgements
139 | Role::DocAfterword
140 | Role::DocAppendix
141 | Role::DocBibliography
142 | Role::DocChapter
143 | Role::DocConclusion
144 | Role::DocCredits

Callers 15

get_roleMethod · 0.45
application_cache_itemFunction · 0.45
add_nodeMethod · 0.45
remove_nodeMethod · 0.45
root_windowFunction · 0.45
cache_nodeMethod · 0.45
stateMethod · 0.45
layerMethod · 0.45
control_typeMethod · 0.45

Calls 4

has_role_descriptionMethod · 0.80
toggledMethod · 0.80
NodeWrapperClass · 0.70
resolveMethod · 0.45

Tested by

no test coverage detected