Skip to content

FB21736620: kAXVisibleCharacterRangeAttribute returns wrong range length in SwiftUI TextEditor on macOS Tahoe when caret is at the end of TextEditor #757

@godbout

Description

@godbout

Submission Date

2026-01-24

Status

Open

Area

Accessibility Framework

Operating System Version

macOS 26.2

Type

Incorrect/Unexpected Behavior

Description

a clear description of the problem

when using the Accessibility Framework, getting kAXVisibleCharacterRangeAttribute for a TextArea built with the SwiftUI TextEditor when the caret is at the end of the TextEditor returns 0, which is wrong. it should return the length of the visible text.

a step by step set of instructions to reproduce the problem

i've made a project that showcases the issue: https://github.com/godbout/macOSTahoeAXVisibleCharacterRangeBug

the steps:

  1. git clone the project
  2. run it
  3. start typing in the TextEditor
  4. see the visible character range being printed in the Xcode debug console
  5. notice that when you're typing at the end of the TextEditor the length is 0 instead of the correct length. pressing the delete key to remove a character will make the right length shown

i will be attaching a video too to this FB.

what results you expected

the API should return the proper length of the visible characters, which should be its count, not 0.

what results you actually saw

the length is being 0 instead of the real length of the visible characters. it creates issue for AX third party apps that rely on this information.

the version of Xcode you are using

Xcode 26.2 17C52

Untitled.mp4

Keywords

accessibility, swiftui, texteditor, visiblecharacterrange

Prerequisites

  • The title follows the format FB<number>: <title>
  • I will keep this issue updated with Apple's responses

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions