Skip to content

wrong AX line number and line range (location and length) on macOS using the macOS Accessibility Framework #47393

Closed as not planned

Description

@godbout

Preflight Checklist

Electron Version

34.0.0

What operating system(s) are you using?

macOS

Operating System Version

macOS Sequoia 15.5 (24F74)

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

No response

Expected Behavior

using the macOS Accessibility Framework:

  1. getting the line number should return 0 if on first line, 1 if on second line, 2 if on third line, etc.
  2. getting the line range should return the correct location of the beginning of the line, and the correct line length

Actual Behavior

  1. the line number is only correct if the caret location is at the beginning of a line. if it is anywhere else on that line, the line number is wrong (ends up being the line number of the NEXT line)
  2. the line range is also only correct if the caret location is at the beginning of a line. anywhere else and what we get is the data from the NEXT line

Testcase Gist URL

No response

Additional Information

a video showcasing the issue:

Screen.Recording.2025-06-06.at.17.16.56.mov

also a project that you can run to test: https://github.com/godbout/AXRangeForLineElectronBug

this happens in any app that is built on top of Electron. makes it impossible to use the macOS AX Framework to do cool stuff on Electron apps.

Activity

  1. added theissue type on Jun 6, 2025
  2. codebytere commented on Jun 6, 2025

    @codebytere
    Member

    @godbout does this also happen with Chrome?

  3. added
    blocked/need-info ❌
    on Jun 6, 2025
  4. godbout commented on Jun 6, 2025

    @godbout
    Author

    @godbout does this also happen with Chrome?

    Chrome has its own set of issues. for example on text fields only the line number is wrong. line range is correct, wherever your caret location is. for text areas both line number or line range are incorrect, although the line range issue is different from what i see with Electron. (Chrome it always gives the data from the first line, Electron gives the data from the next line.)

  5. removed
    blocked/need-info ❌
    on Jun 6, 2025
  6. nikwen commented on Jun 6, 2025

    @nikwen
    Member

    Thanks for reporting!

    Even though you say it affects all Electron apps, could you please use Electron Fiddle to create a simple example app and publish it from Electron Fiddle as a GitHub gist? Applying the blocked/need-repro label until then.

  7. electron-issue-triage commented on Jun 6, 2025

    @electron-issue-triage

    Hello @godbout. Thanks for reporting this and helping to make Electron better!

    Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, Electron Fiddle is a great tool for making small test cases and makes it easy to publish your test case to a gist that Electron maintainers can use.

    Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests.

    Now adding the blocked/need-repro Needs a test case to reproduce the bug label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.

  8. 1 remaining item

  9. removed
    blocked/need-repro
    on Jun 6, 2025
  10. added
    blocked/need-repro
    on Jun 6, 2025
  11. godbout commented on Jun 6, 2025

    @godbout
    Author

    Thanks for reporting!

    Even though you say it affects all Electron apps, could you please use Electron Fiddle to create a simple example app and publish it from Electron Fiddle as a GitHub gist? Applying the blocked/need-repro label until then.

    alright, will try. thanks.

  12. removed
    blocked/need-repro
    on Jun 6, 2025
  13. added
    blocked/need-repro
    on Jun 6, 2025
  14. godbout commented on Jun 6, 2025

    @godbout
    Author

    @nikwen here you go: https://gist.github.com/godbout/a0cf7b46e4032790bb22281f9cdb39a4

    i've used v36.4.0, and although the behavior is still not the one expected, it's now what i'm describing above regarding Chrome. which means the line number is not correct if not on the first character of a line, and line range returned is always the line range from the first line (which, in case of text fields, therefore happens to be correct lol).

    thanks for having a look at this, and please lemme know if this should be reported to Chrome/Chromium/Blink also/instead. (although it will affect every Electron app, so i think if it's a Chrome/Chromium/Blink issue you guys should really push for it to be fixed!)

  15. removed
    blocked/need-repro
    on Jun 6, 2025
  16. nikwen commented on Jun 6, 2025

    @nikwen
    Member

    i've used v36.4.0, and although the behavior is still not the one expected, it's now what i'm describing above regarding Chrome.

    Thanks for making the gist and testing on v36!

    If the behavior is the same as in Chrome, that means that Electron isn't doing anything special here and just inheriting Chromium's behavior. In those cases, there's no Electron-specific code, so the issue needs to be fixed and reported in Chromium.

    Please file an issue for this bug in the Chromium issue tracker. Please include the index.html file from the your testcase gist. That will help Chromium developers reproduce the issue (and thus it will increase the chances of it being fixed).

    Then please share the link to the Chromium issue here.

    Because this is an upstream issue, I'll close this issue in the Electron issue tracker. However, as mentioned, please do report it in the Chromium bug tracker to get it fixed. Thanks!

  17. added
    has-repro-gist
    on Jun 6, 2025
  18. godbout commented on Jun 7, 2025

    @godbout
    Author

    as a starter, issue regarding the line number that i reported in 2022: https://issues.chromium.org/issues/40839954

    i'll ping them again regarding this. will open a new issue regarding the line range, and will update this issue with a link to the new bug report.

  19. godbout commented on Jun 7, 2025

    @godbout
    Author

    new showcase GH repo to make it clear it's a Chromium bug, not an Electron one per se: https://github.com/godbout/AXLineNumberAndLineRangeChromiumBugs

  20. godbout commented on Jun 7, 2025

    @godbout
    Author
  21. godbout commented on Nov 4, 2026

    @godbout
    Author

    THIS HAS BEEN FIXED IN CHROMIUM FINALLY AFTER YEARS OF TALK! Osome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    34-x-y36-x-ya11ybug 🪲component/accessibilityhas-repro-gistplatform/macOS

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions