mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 13:11:13 +00:00
a11y: Add article and comment roles
Add new accessible roles GTK_ACCESSIBLE_ROLE_ARTICLE and GTK_ACCESSIBLE_ROLE_COMMENT. ARIA has corresponding roles as well [1] [2], with the article role being the superclass role of the comment role. Acccording to the ARIA spec, the article role has the document role as superclass role and the name can be set by the author. For the comment role, the name can be set by the author or come from the content. The ARIA spec for the comment contains this sentence [2]: > If the author has not explicitly declared aria-level, aria-posinset, or > aria-setsize for a comment element, user agents MUST automatically > compute the missing values and expose them to assistive technologies. However, these properties are not listed as "Required States and Properties" in the following table for that role. Potentially the above requirement only applies for the first of the two possible described cases of how the relationship between comments and the commented content can be set, so don't hard-require these attributes in the a11y overlay's `check_widget_accessibility_errors` either. [1] https://w3c.github.io/aria/#article [2] https://w3c.github.io/aria/#comment
This commit is contained in:
parent
9d7389aea7
commit
ab7592ee4f
@ -48,6 +48,9 @@ gtk_accessible_role_to_atspi_role (GtkAccessibleRole role)
|
||||
case GTK_ACCESSIBLE_ROLE_APPLICATION:
|
||||
return ATSPI_ROLE_FRAME;
|
||||
|
||||
case GTK_ACCESSIBLE_ROLE_ARTICLE:
|
||||
return ATSPI_ROLE_ARTICLE;
|
||||
|
||||
case GTK_ACCESSIBLE_ROLE_BANNER:
|
||||
break;
|
||||
|
||||
@ -75,6 +78,9 @@ gtk_accessible_role_to_atspi_role (GtkAccessibleRole role)
|
||||
case GTK_ACCESSIBLE_ROLE_COMMAND:
|
||||
break;
|
||||
|
||||
case GTK_ACCESSIBLE_ROLE_COMMENT:
|
||||
return ATSPI_ROLE_COMMENT;
|
||||
|
||||
case GTK_ACCESSIBLE_ROLE_COMPOSITE:
|
||||
break;
|
||||
|
||||
|
@ -834,6 +834,8 @@ static const char *role_names[] = {
|
||||
[GTK_ACCESSIBLE_ROLE_APPLICATION] = NC_("accessibility", "application"),
|
||||
[GTK_ACCESSIBLE_ROLE_PARAGRAPH] = NC_("accessibility", "paragraph"),
|
||||
[GTK_ACCESSIBLE_ROLE_BLOCK_QUOTE] = NC_("accessibility", "block quote"),
|
||||
[GTK_ACCESSIBLE_ROLE_ARTICLE] = NC_("accessibility", "article"),
|
||||
[GTK_ACCESSIBLE_ROLE_COMMENT] = NC_("accessibility", "comment"),
|
||||
};
|
||||
|
||||
/*< private >
|
||||
@ -950,6 +952,8 @@ static struct {
|
||||
{ GTK_ACCESSIBLE_ROLE_ALERT, GTK_ACCESSIBLE_ROLE_ALERT_DIALOG },
|
||||
{ GTK_ACCESSIBLE_ROLE_STATUS, GTK_ACCESSIBLE_ROLE_TIMER },
|
||||
{ GTK_ACCESSIBLE_ROLE_DIALOG, GTK_ACCESSIBLE_ROLE_ALERT_DIALOG },
|
||||
{ GTK_ACCESSIBLE_ROLE_DOCUMENT, GTK_ACCESSIBLE_ROLE_ARTICLE },
|
||||
{ GTK_ACCESSIBLE_ROLE_ARTICLE, GTK_ACCESSIBLE_ROLE_COMMENT },
|
||||
};
|
||||
|
||||
gboolean
|
||||
|
@ -1025,6 +1025,7 @@ gtk_at_context_get_accessible_relation (GtkATContext *self,
|
||||
static guint8 naming[] = {
|
||||
[GTK_ACCESSIBLE_ROLE_ALERT] = NAME_FROM_AUTHOR,
|
||||
[GTK_ACCESSIBLE_ROLE_ALERT_DIALOG] = NAME_FROM_AUTHOR|GTK_ACCESSIBLE_NAME_REQUIRED,
|
||||
[GTK_ACCESSIBLE_ROLE_ARTICLE] = NAME_FROM_AUTHOR,
|
||||
[GTK_ACCESSIBLE_ROLE_BANNER] = GTK_ACCESSIBLE_NAME_PROHIBITED,
|
||||
[GTK_ACCESSIBLE_ROLE_BLOCK_QUOTE] = NAME_FROM_AUTHOR,
|
||||
[GTK_ACCESSIBLE_ROLE_BUTTON] = NAME_FROM_AUTHOR|NAME_FROM_CONTENT|GTK_ACCESSIBLE_NAME_REQUIRED,
|
||||
@ -1034,6 +1035,7 @@ static guint8 naming[] = {
|
||||
[GTK_ACCESSIBLE_ROLE_COLUMN_HEADER] = NAME_FROM_AUTHOR|NAME_FROM_CONTENT|GTK_ACCESSIBLE_NAME_REQUIRED,
|
||||
[GTK_ACCESSIBLE_ROLE_COMBO_BOX] = NAME_FROM_AUTHOR|GTK_ACCESSIBLE_NAME_REQUIRED,
|
||||
[GTK_ACCESSIBLE_ROLE_COMMAND] = GTK_ACCESSIBLE_NAME_PROHIBITED,
|
||||
[GTK_ACCESSIBLE_ROLE_COMMENT] = NAME_FROM_AUTHOR|NAME_FROM_CONTENT,
|
||||
[GTK_ACCESSIBLE_ROLE_COMPOSITE] = GTK_ACCESSIBLE_NAME_PROHIBITED,
|
||||
[GTK_ACCESSIBLE_ROLE_DIALOG] = NAME_FROM_AUTHOR|GTK_ACCESSIBLE_NAME_REQUIRED,
|
||||
[GTK_ACCESSIBLE_ROLE_DOCUMENT] = NAME_FROM_AUTHOR,
|
||||
|
@ -1367,6 +1367,12 @@ typedef enum {
|
||||
* @GTK_ACCESSIBLE_ROLE_BLOCK_QUOTE: A section of content that is quoted
|
||||
* from another source.
|
||||
* Since: 4.14
|
||||
* @GTK_ACCESSIBLE_ROLE_ARTICLE: A section of a page that consists of a
|
||||
* composition that forms an independent part of a document, page, or site.
|
||||
* Since: 4.14
|
||||
* @GTK_ACCESSIBLE_ROLE_COMMENT: A comment contains content expressing reaction
|
||||
* to other content.
|
||||
* Since: 4.14
|
||||
*
|
||||
* The accessible role for a [iface@Accessible] implementation.
|
||||
*
|
||||
@ -1455,7 +1461,9 @@ typedef enum {
|
||||
GTK_ACCESSIBLE_ROLE_TOGGLE_BUTTON GDK_AVAILABLE_ENUMERATOR_IN_4_10,
|
||||
GTK_ACCESSIBLE_ROLE_APPLICATION GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||
GTK_ACCESSIBLE_ROLE_PARAGRAPH GDK_AVAILABLE_ENUMERATOR_IN_4_14,
|
||||
GTK_ACCESSIBLE_ROLE_BLOCK_QUOTE GDK_AVAILABLE_ENUMERATOR_IN_4_14
|
||||
GTK_ACCESSIBLE_ROLE_BLOCK_QUOTE GDK_AVAILABLE_ENUMERATOR_IN_4_14,
|
||||
GTK_ACCESSIBLE_ROLE_ARTICLE GDK_AVAILABLE_ENUMERATOR_IN_4_14,
|
||||
GTK_ACCESSIBLE_ROLE_COMMENT GDK_AVAILABLE_ENUMERATOR_IN_4_14
|
||||
} GtkAccessibleRole;
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user