Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IA2TextTextInfo.expand: Correctly add the text start offset when adjusting for embedded objects during mouse navigation. #16912

Merged
merged 1 commit into from
Jul 28, 2024

Conversation

jcsteh
Copy link
Contributor

@jcsteh jcsteh commented Jul 25, 2024

Link to issue number:

Fixes #15990.

Summary of the issue:

In Firefox, when a paragraph, line, etc. contains links (or other elements), moving the mouse over text before or after the link sometimes doesn't report the text correctly. I attempted to fix this in #14755, and while my fix did work in some cases, it seems it wasn't quite complete.

Description of user facing changes

In Mozilla Firefox, moving the mouse over text before or after a link now reliably reports the text.

Description of development approach

To search for embedded objects, IA2TextTextInfo.expand fetches the text between the expanded start and end offsets. Previously, when adjusting the offsets if an embedded object was found, the code didn't add the offset from the start of the object to the start of the retrieved text. Now it does.

Testing strategy:

Verified that the reported failures in #15990 (comment) and #16902 (comment) work as expected with this change.
Also verified with this distilled test case:
data:text/html,<p>ab<br>bcd <a href="/">efg</a> hij
Before this change, with mouse reading unit set to paragraph, moving the mouse to b only reported "b" and moving the mouse to h reported "cd hij". After this change, moving the mouse to b reports "bcd" and moving the mouse to h reports "hij", as expected.

Known issues with pull request:

None.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

Summary by CodeRabbit

  • New Features

    • Enhanced text reporting for links in Mozilla Firefox, ensuring consistent and accurate text feedback when hovering the mouse over links.
  • Bug Fixes

    • Improved accuracy of text range offsets in the expand method, refining the detection of embedded objects within text.

…sting for embedded objects during mouse navigation.
@jcsteh jcsteh requested a review from a team as a code owner July 25, 2024 10:15
@jcsteh jcsteh requested a review from seanbudd July 25, 2024 10:15
Copy link
Contributor

coderabbitai bot commented Jul 25, 2024

Walkthrough

The recent changes enhance the NVDA screen reader's text reporting capabilities, particularly in Mozilla Firefox. The modifications ensure more reliable and accurate reporting of text surrounding links when the mouse hovers over them. This improvement aims to provide a better user experience by ensuring consistent text feedback while navigating web content, thereby contributing to the overall accessibility of NVDA.

Changes

Files Change Summary
source/NVDAObjects/IAccessible/__init__.py Modified expand method to improve calculation of text offsets for embedded objects.
user_docs/en/changes.md Added description of enhanced mouse navigation support in Firefox for consistent text reporting.

Assessment against linked issues

Objective Addressed Explanation
Improve text reporting during mouse navigation in Firefox (#15990)
Ensure the screen reader reliably reports text around links (#15990)

Recent review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3f82ab6 and 1de5087.

Files selected for processing (2)
  • source/NVDAObjects/IAccessible/init.py (1 hunks)
  • user_docs/en/changes.md (1 hunks)
Additional context used
Path-based instructions (2)
source/NVDAObjects/IAccessible/__init__.py (2)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious.


Pattern **/*.py: _, pgettext, ngettext, and ngettext are defined globally, errors for this being undefined can be ignored.

user_docs/en/changes.md (3)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious.


Pattern **/*.md: Focus on grammar, spelling, and punctuation. Also consider readability and clarity of contents. Ensure that changes follow the style of one sentence per line, suggest changes if this is not met.


Pattern user_docs/en/changes.md: Ensure each change log entry references an issue or pull request number. Change log entries can also include a reference to a GitHub author. Examples of valid change log entries: * Item with sub-items (#123, @username): * sub-item * bar (#342) * Item with. Multiple lines. (#143)

Additional comments not posted (4)
source/NVDAObjects/IAccessible/__init__.py (3)

251-251: Ensure textStart variable is correctly initialized.

The textStart variable is introduced to hold the original _startOffset. Ensure that it is correctly initialized and used consistently throughout the method.


258-258: Verify the usage of textStart in adjusting _startOffset.

The _startOffset is adjusted by adding textStart to the result of text.rindex. Ensure that this adjustment correctly accounts for the start of the text range.


263-263: Verify the usage of textStart in adjusting _endOffset.

The _endOffset is adjusted by adding textStart to the result of text.index. Ensure that this adjustment correctly accounts for the start of the text range.

user_docs/en/changes.md (1)

23-23: LGTM!

The changelog entry is clear, concise, and follows the style guidelines. It references the relevant issue number and GitHub author.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@michaelDCurran michaelDCurran merged commit d7ae6df into nvaccess:master Jul 28, 2024
1 check passed
@jcsteh jcsteh deleted the mouse branch July 31, 2024 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mouse navigation in Firefox: Speech a portion of text aloud or do not speech text in certain paragraphs
2 participants