1
0
mirror of https://github.com/godotengine/godot.git synced 2026-01-06 19:41:11 +00:00

Accessibility: Fix text field character count and line navigation

Two fixes for text field accessibility:

1. Fix character count being off by one due to trailing newline always
   being appended to the last line. Add `is_last_line` parameter to
   `accessibility_create_sub_text_edit_elements()` to control this.

2. Link adjacent TextRuns via `previous_on_line`/`next_on_line` so
   screen readers can properly navigate lines. Without these links,
   AccessKit treats each TextRun as a separate line, causing incorrect
   announcements when arrowing through multi-line text.
This commit is contained in:
Nolan Darilek
2025-12-02 14:54:14 -05:00
parent 7a228b4b91
commit 6304e9f876
10 changed files with 50 additions and 28 deletions

View File

@@ -1311,7 +1311,7 @@ void LineEdit::_notification(int p_what) {
float text_off_x = x_ofs + scroll_offset;
if (accessibility_text_root_element.is_null()) {
accessibility_text_root_element = DisplayServer::get_singleton()->accessibility_create_sub_text_edit_elements(ae, using_placeholder ? RID() : text_rid, text_height);
accessibility_text_root_element = DisplayServer::get_singleton()->accessibility_create_sub_text_edit_elements(ae, using_placeholder ? RID() : text_rid, text_height, -1, true);
}
Transform2D text_xform;