Skip to content

soffice: Report keyboard-triggered paragraph style change#17153

Merged
seanbudd merged 6 commits into
nvaccess:masterfrom
michaelweghorn:michaelweghorn/report_paragraph_style_change
Sep 17, 2024
Merged

soffice: Report keyboard-triggered paragraph style change#17153
seanbudd merged 6 commits into
nvaccess:masterfrom
michaelweghorn:michaelweghorn/report_paragraph_style_change

Conversation

@michaelweghorn

@michaelweghorn michaelweghorn commented Sep 10, 2024

Copy link
Copy Markdown
Contributor

Link to issue number:

Partially implements feature requests from #6915

Summary of the issue:

Commit 20bdb39
("soffice: Report keyboard-triggered font size change (#17147)") implemented announcement of the new value of the font size combobox in Writer's formatting toolbar when it is changed via keyboard shortcut. Issue #6915 requests announcement of further attributes, including the announcement of the current paragraph style when applying "Heading 1",..., "Heading 5" styles via the Ctrl+1,..., Ctrl+5 keyboard shortcuts.

Description of user facing changes

When applying the "Body Text" or a heading paragraph style using the corresponding keyboard shortcut in LibreOffice Writer 25.2 or newer, NVDA announces the new paragraph style.

Description of development approach

Extend the solution from the above-mentioned
commit 20bdb39.
Other than the simpler case of the font size combo box, changing the paragraph style can imply more related formatting changes (e.g. font size, bold,...).
To avoid triggering the announcement of these implicit formatting changes, but rather announce the new paragraph style to confirm that the user-triggered action had the expected result, introduce a way to reliably identify the paragraph style combobox in the formatting toolbar:

  1. Add an "id" object attribute to the IAccessible2 object attribute specification:

This identifier remains the same across different sessions of
the same application, regardless of the UI language.

IAccessible2 commit: LinuxA11y/IAccessible2@2b8c2c7

  1. In LibreOffice, set the "id" attribute to the ID already used in the UI file format (GtkBuilder XML files): https://git.libreoffice.org/core/commit/21b29f25660db973fa1480de77e6a69d76a5de53

  2. In NVDA, extend the logic for announcing gesture-triggered formatting changes to allow specifying a specific ID of the UI element(s) of interest. If one is set, don't announce changes in other UI elements for that gesture.
    Set the ID to the one that the paragraph style combobox in Writer's formatting toolbar has ("applystyle").
    Let NVDA handle the Ctrl+0, Ctrl+1, Ctrl+2, Ctrl+3, Ctrl+4 and Ctrl+5 gestures to announce the new paragraph style ("Body Text" for Ctrl+0, corresponding heading for Ctrl+1 through Ctrl+5).

Testing strategy:

  1. start NVDA
  2. start current development version of LibreOffice Writer (with English UI and keyboard layout)
  3. Press Ctrl+1 to apply paragraph Style "Heading 1"
  4. Verify that NVDA announces the new paragraph style by name, i.e. says "Heading 1"
  5. Repeat steps 3 and 4 with Ctrl+2, Ctrl+3, Ctrl+4, Ctrl+5 to verify that the other heading levels are also announced correctly.
  6. Press Ctrl+0 to apply paragraph style "Body Text" and verify that NVDA announces the new paragraph style by name, i.e. says "Body Text"
  7. Retest that the other supported keyboard gestures as implemented in commits 46a3436 and 20bdb39 are still announced as expected.

Known issues with pull request:

None, but note that a current LibreOffice development version (to become LibreOffice 25.2) is required for the feature to actually work.

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.

@coderabbitai summary

 ### Link to issue number:

Partially implements feature requests from nvaccess#6915

 ### Summary of the issue:

Commit 20bdb39
("soffice: Report keyboard-triggered font size change (nvaccess#17147)")
implemented announcement of the new value of the font size combobox
in Writer's formatting toolbar when it is changed via keyboard shortcut.
Issue nvaccess#6915 requests announcement of further attributes, including
the announcement of the current paragraph style when applying
"Heading 1",..., "Heading 5" styles via the Ctrl+1,..., Ctrl+5 keyboard
shortcuts.

 ### Description of user facing changes

When applying the "Body Text" or a heading paragraph
style using the corresponding keyboard shortcut in
LibreOffice Writer 25.2 or newer, NVDA announces the
new paragraph style.

 ### Description of development approach

Extend the solution from the above-mentioned
commit 20bdb39.
Other than the simpler case of the font size combo box,
changing the paragraph style can imply more related
formatting changes (e.g. font size, bold,...).
To avoid triggering the announcement of these implicit
formatting changes, but rather announce the new paragraph
style to confirm that the user-triggered action had the
expected result, introduce a way to reliably identify the
paragraph style combobox in the formatting toolbar:

1) Add an "id" object attribute to the IAccessible2 object attribute
specification:

> This identifier remains the same across different sessions of
> the same application, regardless of the UI language.

IAccessible2 commit: LinuxA11y/IAccessible2@2b8c2c7

2) In LibreOffice, set the "id" attribute to the ID
already used in the UI file format (GtkBuilder XML files):
https://git.libreoffice.org/core/commit/21b29f25660db973fa1480de77e6a69d76a5de53

3) In NVDA, extend the logic for announcing gesture-triggered
formatting changes to allow specifying a specific ID of the
UI element(s) of interest. If one is set, don't announce
changes in other UI elements for that gesture.
Set the ID to the one that the paragraph style combobox in
Writer's formatting toolbar has ("applystyle").
Let NVDA handle the Ctrl+0, Ctrl+1, Ctrl+2, Ctrl+3, Ctrl+4 and Ctrl+5
gestures to announce the new paragraph style ("Body Text" for Ctrl+0,
corresponding heading for Ctrl+1 through Ctrl+5).

 ### Testing strategy:

1. start NVDA
2. start current development version of LibreOffice Writer (with English UI and keyboard layout)
3. Press Ctrl+1 to apply paragraph Style "Heading 1"
4. Verify that NVDA announces the new paragraph style by name, i.e. says "Heading 1"
5. Repeat steps 3 and 4 with Ctrl+2, Ctrl+3, Ctrl+4, Ctrl+5 to verify
   that the other heading levels are also announced correctly.
6. Press Ctrl+0 to apply paragraph style "Body Text" and verify
   that NVDA announces the new paragraph style by name, i.e. says "Body Text"
8. Retest that the other supported keyboard gestures as implemented in
   commits 46a3436 and
   20bdb39 are still announced as
   expected.

 ### Known issues with pull request:

None, but note that a current LibreOffice development version
(to become LibreOffice 25.2) is required for the feature to actually work.

 ### Code Review Checklist:

- [x] Documentation:
  - Change log entry
  - User Documentation
  - Developer / Technical Documentation
  - Context sensitive help for GUI changes
- [x] Testing:
  - Unit tests
  - System (end to end) tests
  - Manual testing
- [x] UX of all users considered:
  - Speech
  - Braille
  - Low Vision
  - Different web browsers
  - Localization in other languages / culture than English
- [x] API is compatible with existing add-ons.
- [x] Security precautions taken.
@michaelweghorn michaelweghorn force-pushed the michaelweghorn/report_paragraph_style_change branch from a6a9659 to 9a9b6c4 Compare September 10, 2024 11:53
@michaelweghorn michaelweghorn marked this pull request as ready for review September 10, 2024 13:10
@michaelweghorn michaelweghorn requested a review from a team as a code owner September 10, 2024 13:10

@SaschaCowley SaschaCowley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, @michaelweghorn. Everything looks sound to me, I just have a request for a few type hints.

Comment thread source/appModules/soffice.py Outdated
Comment thread source/appModules/soffice.py Outdated
Comment thread source/appModules/soffice.py Outdated
Comment thread source/appModules/soffice.py
michaelweghorn and others added 3 commits September 16, 2024 08:44
Co-authored-by: Sascha Cowley <16543535+SaschaCowley@users.noreply.github.com>
Co-authored-by: Sean Budd <seanbudd123@gmail.com>
@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Sep 17, 2024
@seanbudd seanbudd merged commit 8827e60 into nvaccess:master Sep 17, 2024
@github-actions github-actions Bot added this to the 2025.1 milestone Sep 17, 2024
@michaelweghorn michaelweghorn deleted the michaelweghorn/report_paragraph_style_change branch September 17, 2024 06:34
seanbudd pushed a commit that referenced this pull request Mar 27, 2025
Fix-up of #17153.

Summary of the issue:
When modifying heading style with ctrl+1/2/3/4/5 or turning back to body text with ctrl+0, other formatting changes might be reported in languages where "ctrl" is translated differently, e.g. "Strg" in German.

Description of user facing changes
Only style and no other associated formatting changes should be reported when modifying heading styles with ctrl+1/2/3/4/5 or turning back to body text with ctrl+0.

Description of development approach
Do not use the displayName property to define which type of gesture we are dealing with, Use modifierNames and mainKeyName properties instead since they are not translated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants