We’re trying to make a game accessible to screenreaders. The navigation tools of the screenreader use Godot’s node tree, analogous to how they would read a web page.
For nodes like buttons, this works fine.
Containers are normally ignored, but 4.7 adds the property accessibility_region, which can be set to override this. Great!
Our problem is that we have some nodes that are children of a Control instead of a Container. (Why? It’s a grid of hexagons, so they have specific placements. Any container would rearrange them.)
The Control is ignored by the screenreader’s navigation, but doesn’t have accessibility_region.
How can we make this focusable for the screenreader? Is there a different kind of container node we should use?
There are three solutions I can think of, keeping in mind I’ve never tried to implement screen reading in Godot. (Props to you for doing that.)
Make a request for a new feature in Godot Proposals to add this to Control nodes.
You might also check the merged ticket and contact the implementor. From context it sounds like this is a person who uses the feature themselves, and might be able to help you figure out how to use it effectively.
Inherit the Container class and override the fit_child_in_rect() to handle your hexagons.
extends Control
func _notification(what: int) -> void:
if what == NOTIFICATION_ACCESSIBILITY_UPDATE:
var rid = get_accessibility_element()
AccessibilityServer.update_set_role(rid, AccessibilityServer.ROLE_REGION)
Parser Error: The method "fit_child_in_rect()" overrides a method from native class "Container". This won't be called by the engine and may not work as expected. (Warning treated as error.)