Skip to content

Commit 5c56da9

Browse files
committed
Merge branch 'main' of https://github.com/btzr-io/godot-aria into main
2 parents b04f55e + 41819c9 commit 5c56da9

File tree

1 file changed

+61
-8
lines changed

1 file changed

+61
-8
lines changed

README.md

Lines changed: 61 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,54 @@
11
> [!note]
22
> Experimental plugin, feel free to contribute or report any issues to improve compatibility with more web browsers and screen readers.
3+
34
# Godot-ARIA
45
A plugin for creating accessible rich internet applications with godot.
56

6-
Screen Reader | Browsers | Compatibility
7-
| --- | --- | --- |
8-
| NVDA | Firefox, Chrome, Edge | Yes
7+
For more information about screen readers and browsers compatibility please see: [current live region behaviour](https://tetralogical.com/blog/2024/05/01/why-are-my-live-regions-not-working/#current-live-region-behaviour).
98

109

11-
For information about other screen readers or browsers, please see: [current live region behaviour](https://tetralogical.com/blog/2024/05/01/why-are-my-live-regions-not-working/#current-live-region-behaviour).
10+
### Features
11+
- Accessible html page template.
12+
- Notifiy changes or important alerts to screen readers.
13+
- Restore or gain focus with tab / shift + tab navigation.
14+
- Focus can leave the canvas element to navigate other content on the web page.
15+
- Accessibility module for Node2D.
1216

1317
## Installation
1418
Just add the addons folder to your project and enable the plugin.
1519

1620
See: [Installing a plugin](https://docs.godotengine.org/en/stable/tutorials/plugins/editor/installing_plugins.html#installing-a-plugin)
1721

18-
## Custom html page
22+
## Export configuration
1923
> [!warning]
2024
> The default godot web export HTML page has accessibility [issues](https://github.com/btzr-io/godot-aria/issues/4) and is not compatible with this pluign.
2125
22-
This repository provides a more accessible version that can serve as a starting point: [godot_aria_shell.html](https://github.com/btzr-io/godot-aria/blob/main/addons/godot-aria/godot_aria_shell.html)
26+
Before you can use this addon you need to make some quick changes to the export settings:
27+
28+
- This repository provides a more accessible HTML page that can serve as a starting point: [godot_aria_shell.html](https://github.com/btzr-io/godot-aria/blob/main/addons/godot-aria/godot_aria_shell.html)
2329

30+
- Auto focus behavior is not recommended, the user should decide when to enter focus ( click or tab navigation ).
31+
2432
```shell
25-
Export > html/custom_html_shell = "res://addons/godot-aria/godot_aria_shell.html"
33+
Export > html/custom_html_shell: "res://addons/godot-aria/godot_aria_shell.html"
34+
Export > html/focus_canvas_on_start: false
2635
```
2736

2837
See: [Custom HTML page for Web export](https://docs.godotengine.org/en/stable/tutorials/platform/web/customizing_html5_shell.html#custom-html-page-for-web-export)
2938

3039
## Usage
31-
Global class `GodotARIA` provides a way to send messages and alerts to screen readers as [aria-live](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live) updates.
40+
Global class `GodotARIA` provides methods to manage focus for the html canvas element and a way to send notifications or alerts to screen readers as [aria-live](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live) updates.
41+
### GodotARIA.focus_canvas
42+
Focus the current canvas element.
43+
```py
44+
GodotARIA.focus_canvas()
45+
```
46+
47+
### GodotARIA.unfocus_canvas
48+
Remove focus of the current canvas element.
49+
```py
50+
GodotARIA.unfocus_canvas()
51+
```
3252

3353
### GodotARIA.notify_screen_reader
3454
Awaits for a natural pause before speaking up. It won’t interrupt what the screen reader is currently announcing. Equivalent to aria-live [polite](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live#polite).
@@ -41,3 +61,36 @@ Speak an alert, interrupts whatever the screen reader is currently announcing. E
4161
```py
4262
GodotARIA.alert_screen_reader(message: String)
4363
```
64+
65+
## Accessibiltiy module for Node2D
66+
To make any Node2D accessible you can add the custom node AccessibleModule as a direct child, this will create an overlay control to handle the focus behavior.
67+
68+
### Features
69+
- Add focus behavior.
70+
- Custom focus style.
71+
- Tab navigation between other focusable elements.
72+
- Notify name or description to screen readers on focus.
73+
74+
### Properties
75+
#### aria_label : String
76+
Name or description to be anounced by screen readers.
77+
78+
#### focus_mode : Control.FocusMode
79+
Focus mode of the overlay control: None, Click, All.
80+
81+
#### focus_size : Vector2
82+
The focusable area size, calculated by default if the node has a visible texture or rect.
83+
84+
#### focus_style : StyleBox
85+
Add a custom style if needed, otherwise you can use has_focus() and apply a custom focus indicator on the node.
86+
87+
#### focus_control : FocusControl
88+
Reference of the overlay control that manages the focus behavior, use this property to interact directly with the overlay control.
89+
90+
### Methods
91+
92+
#### grab_focus() -> void
93+
Focus the overlay control.
94+
95+
#### has_focus() -> bool
96+
Checks if the overlay control has focus.

0 commit comments

Comments
 (0)