Commit Graph

66790 Commits

Author SHA1 Message Date
Emmanuele Bassi
80756322cd a11y: Handle relations in UI files
A bit hacky: we skip parsing values that have a reference or
reference-list type, but we do not error out. Instead, we return a NULL
value, which we catch in the GtkBuildable interface implementation to
get the actual object, and construct a reference list value.

There's still some ickyness around the value type that can only be
solved by having an attribute and role taxonomy.
2020-10-21 14:48:49 +01:00
Emmanuele Bassi
7702670d86 docs: Document the "accessibility" custom tag 2020-10-21 13:33:37 +01:00
Emmanuele Bassi
9e4316bf96 a11y: Add an "accessibility" section to the builder XML tree
Accessible attributes are not GObject properties. This means that we
need a custom parser for setting attributes in our UI description files.

The new section is defined as a sub-tree with the `<accessibility>`
element at its root, and elements for each type of accessible
attributes, i.e. properties, relations, and states:

```xml
  <object class="..." id="...">
    <accessibility>
      <property name="label">The accessible label</property>
      <state name="pressed">false</state>
      <relation name="labelled-by">label1</relation>
    </accessibility>
  </object>
```

The name of the attribute is the enumeration value; the value is defined
by the WAI-ARIA specification.
2020-10-21 13:33:37 +01:00
Emmanuele Bassi
4ea2a6628f a11y: Add parsing code for accessible values
We need to be able to go from a string representation of an accessible
value to its GtkAccessibleValue instance.
2020-10-21 13:33:37 +01:00
Matthias Clasen
8880e3bd2e Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2729
2020-10-21 11:43:58 +00:00
Timm Bäder
0b5b908a74 Merge branch 'wip/exalm/nullable' into 'master'
widget: Add missing (nullable) on binding functions

See merge request GNOME/gtk!2730
2020-10-21 08:17:45 +00:00
Alexander Mikhaylenko
31a072497d widget: Add missing (nullable) on binding functions
Even though they are marked as (skip), they are used in Vala and have wrong
types there atm.
2020-10-21 12:27:51 +05:00
Matthias Clasen
cbb6828657 docs: Document more accessible roles
Document that GtkText is skipped in accessibility.
2020-10-20 23:19:30 -04:00
Matthias Clasen
8e170217a1 Cosmetics
Typo fix.
2020-10-20 23:19:18 -04:00
Matthias Clasen
36d4a8090f docs: Document more accessible roles
GtkColumnView and its various components use a lot
of accessible roles.
2020-10-20 23:09:11 -04:00
Matthias Clasen
341244203f docs: Document more accessible roles
GtkListView and GtkGridView were missing this as well.
2020-10-20 22:53:30 -04:00
Matthias Clasen
2023914186 docs: Document accessible roles of some classes
GtkListBox and GtkFlowBox were missing this.
2020-10-20 22:51:11 -04:00
Matthias Clasen
ef9ec43469 a11y: Add some more tests 2020-10-20 22:44:24 -04:00
Matthias Clasen
67411701c6 inspector: Show accessible object path
Show the object path of the object on the a11y bus,
this is can be useful information. While we are here,
make sure that the Inspector does not throw criticals
when used with GTK_NO_A11Y=1.
2020-10-20 21:56:54 -04:00
Matthias Clasen
e20a3339bf atsi: Fix emission of text selection changes
We were not emitting text-selection-changed and
text-caret-moved as expected.
2020-10-20 21:31:23 -04:00
Matthias Clasen
a8baee342c a11y: Fix handling of LABELLED_BY relation
There were several places where we were confusing
GList and GSList and list->data and list->next, causing
a crash in the accessible name computation for buttons
with mnemonic labels.
2020-10-20 21:27:39 -04:00
Matthias Clasen
6a1cb3304b docs: Mention subclassing and destroy in the migration guide
Mention changes regarding subclassing and life-cycle
handling in the migration guide.
2020-10-20 18:26:38 -04:00
Benjamin Otte
45400fe381 Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

Closes #3280

See merge request GNOME/gtk!2725
2020-10-20 14:05:49 +00:00
Matthias Clasen
5504278b78 Merge branch 'matthiasc/for-master' into 'master'
Some more a11y tests

See merge request GNOME/gtk!2726
2020-10-20 05:57:45 +00:00
Matthias Clasen
93481e6c2e a11y: Add tests for GtkFlowBox
Test that roles, states and properties are as expected.
2020-10-20 01:12:20 -04:00
Matthias Clasen
b9e9898212 a11y: Add tests for GtkListBox
Test that roles, states and properties are as expected.
2020-10-20 01:07:13 -04:00
Matthias Clasen
7c47b6907b a11y: Add tests for GtkStack and GtkStackSwitcher
Test that the roles, states and relations are
as expected.
2020-10-20 00:46:07 -04:00
Matthias Clasen
b10d5ec8ff a11y: Add a test for label properties
Now that we set the label property, we should test it too.
2020-10-20 00:25:39 -04:00
Benjamin Otte
8dad615f04 gtk: Remove unused header include
gtkcssnodeprivate.h was mainly used for repositioning CSS nodes in
gadgets, and gadgets are gone now.
2020-10-20 04:50:12 +02:00
Benjamin Otte
23e086089d entry: Keep widget order
... instead of just ordering the CSS nodes.
2020-10-20 04:50:12 +02:00
Benjamin Otte
9317a9f35c flowbox: Keep widget order
... instead of just ordering the CSS nodes.
2020-10-20 04:50:12 +02:00
Benjamin Otte
22100089c3 listbox: Reorder the widgets when sorting
... instead of just reordering the CSS nodes.
2020-10-20 04:50:12 +02:00
Benjamin Otte
074d54ef5a listitemwidget: Remove unnecessary code
gtk_widget_insert_after() reorders CSS nodes properly.
2020-10-20 04:50:12 +02:00
Benjamin Otte
ddd1b0958d notebook: Remove unnecessary code
gtk_widget_insert_after() reorders CSS nodes properly.

Also fix page reordering code to actually reorder the widget instead of
just the CSS nodes.
2020-10-20 04:50:12 +02:00
Benjamin Otte
d77902365d box: Remove unnecessary code
gtk_widget_insert_after() reorders CSS nodes properly.
2020-10-20 04:50:12 +02:00
Benjamin Otte
d9b216e629 widget: Always update the CSS node
Anybody who keeps their own CSS nodes around or wants to order CSS nodes
different from widgets will from now on have to do it manually all the
time.

This is outdated behavior, nobody should be doing either of those two
things.

Also, the correct case is much more common, and not doing it
automatically was causing bugs.

Fixes #3280
2020-10-20 04:50:12 +02:00
Matthias Clasen
a7bd6b094a Merge branch 'matthiasc/for-master' into 'master'
Some a11y docs and fixes

See merge request GNOME/gtk!2724
2020-10-20 01:45:17 +00:00
Matthias Clasen
eeae1b1ea7 a11y: Fix accessible tree inconsistency
The stack page objects were not properly integrated
in the accessible tree - they were appearing as parent
of the pages when navigating up, but not as children
of the stack when navigating down.
2020-10-19 21:15:44 -04:00
Matthias Clasen
0a71dc1bed stack: Minor doc addition 2020-10-19 21:15:44 -04:00
Matthias Clasen
feb73a5ebb docs: Flesh out a11y section
Add some advice for making custom widgets accessible.
2020-10-19 20:01:57 -04:00
Matthias Clasen
83d8ae2f30 Merge branch 'wip/chergert/fix-macos-surface-under-pointer' into 'master'
macos: fix discovery of surface under pointer

See merge request GNOME/gtk!2722
2020-10-19 21:26:47 +00:00
Emmanuele Bassi
51f5690ae3 Merge branch 'ebassi/for-master' into 'master'
Ebassi/for master

See merge request GNOME/gtk!2720
2020-10-19 20:26:57 +00:00
Matthias Clasen
e58e6a0fbe Merge branch 'a11y/editable' into 'master'
Improve the accessible support for editables

See merge request GNOME/gtk!2719
2020-10-19 20:16:21 +00:00
Christian Hergert
eb82b2a9ca macos: fix discovery of surface under pointer 2020-10-19 12:35:41 -07:00
Matthias Clasen
dfc7d26275 a11y: Tweak name and description computation
Instead of falling back to the role nick for both,
fall back to the class name for the name, and to
the empty string for the description. This makes
labels show up in Accerciser the same way they
did in GTK 3, and seems more useful to me than
the alternative.
2020-10-19 14:58:34 -04:00
Matthias Clasen
77d1026c5a atspi: Use name and description as provided
GtkATContext already does fallbacks to derive values
for these, so no need for the atspi implementation to
do its own fallback on top of that.
2020-10-19 14:57:43 -04:00
Matthias Clasen
08ae513064 label: Set the accessible label property
This will make label text show up in ATs again.
2020-10-19 14:29:19 -04:00
Emmanuele Bassi
f52c86ae21 docs: Add a section on a11y patterns 2020-10-19 18:39:40 +01:00
Emmanuele Bassi
03745a489c docs: Start outlining a11y authoring practices
We should have documentation for application developers and widget
authors, so they can deal with the new accessibility API.
2020-10-19 18:37:30 +01:00
Matthias Clasen
63421b1876 a11y: Rename some methods
Our EditableText implementation works fine for any
editable, so don't name the functions in a way that
looks like they are only for entries.
2020-10-19 12:58:29 -04:00
Matthias Clasen
80e0e3fe4f gtk-demo: Set an accessible role
Set the expected accessible role on the tagged entry
widget in the demo of the same name. Accessible tools
may decide to ignore widgets that have the wrong role,
so setting an appropriate role is important.
2020-10-19 12:56:50 -04:00
Matthias Clasen
ef46fe0e8e Merge branch 'a11y/component' into 'master'
a11y: Implement Component

See merge request GNOME/gtk!2718
2020-10-19 16:54:45 +00:00
Emmanuele Bassi
7c7dabae8c a11y: Rework accessible name/description computation
The ARIA spec determines the name and description of accessible elements
in a more complex way that simply mapping to a single property; instead,
it will chain up multiple definitions (if it finds them). For instance,
let's assume we have a button that saves a file selected from a file
selection widget; the widgets have the following attributes:

 - the file selection widget has a "label" attribute set to the
   selected file, e.g. "Final paper.pdf"
 - the "download" button has a "label" attribute set to the
   "Download" string
 - the "download" button has a "labelled-by" attribute set to
   reference the file selection widget

The ARIA spec says that the accessible name of the "Download" button
should be computed as "Download Final paper.pdf".

The algorithm defined in section 4.3 of the WAI-ARIA specification
applies to both accessible names (using the "label" and "labelled-by"
attributes), and to accessible descriptions (using the "description" and
"described-by" attributes).
2020-10-19 17:54:14 +01:00
Matthias Clasen
9f9e7dffef atspi: Implement Text for more editables
Our Text implementation requires that we have
a GtkEditable with a delegate that is a GtkText
widget.

This change make the Text implementation work for
the custom widget in the tagged entry demo.
2020-10-19 12:44:50 -04:00
Goran Vidović
94729b4880 Update Croatian translation
(cherry picked from commit fab2558747)
2020-10-19 16:37:36 +00:00