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

@@ -34,8 +34,10 @@
<param index="1" name="shaped_text" type="RID" />
<param index="2" name="min_height" type="float" />
<param index="3" name="insert_pos" type="int" default="-1" />
<param index="4" name="is_last_line" type="bool" default="false" />
<description>
Creates a new, empty accessibility sub-element from the shaped text buffer. Sub-elements are freed automatically when the parent element is freed, or can be freed early using the [method accessibility_free_element] method.
If [param is_last_line] is [code]true[/code], no trailing newline is appended to the text content. Set to [code]true[/code] for the last line in multi-line text fields and for single-line text fields.
</description>
</method>
<method name="accessibility_element_get_meta" qualifiers="const">