Skip to content

Fix duplicate menu separators - #10533

Merged
timtmok merged 2 commits into
mainfrom
bugfix/electron-menu-separators
Feb 9, 2022
Merged

timtmok merged 2 commits into
mainfrom
bugfix/electron-menu-separators

Conversation

@timtmok

@timtmok timtmok commented Feb 8, 2022 •

Copy link
Copy Markdown
Contributor

Intent

Addresses #9948

Change the eslint config to address the errors about prettier at the top of every file.

Approach

This uses similar logic to how Electron handles menu separators. The difference is that Electron only removes separators if they are at the beginning/end or the previous item is also a separator. Our menus have many hidden items so check doesn't work for us. Even not adding the hidden items still means the separators have to be marked as hidden.

I've added in a check to not add hidden items to menus. The caveat is shortcuts won't work for that command. Although, I don't see that as an issue since the item is likely hidden for a reason. The second part of the fix is using the same logic as Electron to filter out unnecessary separators.

This also runs on MacOS but has no difference since it already hides unnecessary separators. I think it's fine to leave in just in case that ever changes and to maintain the same code across all platforms.

Automated Tests

Added unit tests:

  • check that hidden items also remove any trailing separators
  • check that separators at beginning/end are removed
  • check that multiple separators in a row are condensed to one separator

Unit tests pass on all platforms

QA Notes

The Build menu was most noticeable with this bug. Using Configure Build Tools to change the type will update the Build menu.

Checklist

  • If this PR adds a new feature, or fixes a bug in a previously released version, it includes an entry in NEWS.md
  • If this PR adds or changes UI, the updated UI meets accessibility standards
  • A reviewer is assigned to this PR (if unsure who to assign, check Area Owners list)
  • This PR passes all local unit tests

@timtmok
timtmok requested a review from gtritchie February 8, 2022 22:57
@gtritchie gtritchie added this to the Electron milestone Feb 8, 2022

@gtritchie gtritchie 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.

LGTM! Please modify the PR comment to reword "fixes ####" to "addresses ####" before merging so the issue isn't auto-closed by github.

@timtmok

timtmok commented Feb 9, 2022

Copy link
Copy Markdown
Contributor Author

Good to know about the fixes/addresses

@timtmok
timtmok merged commit f4a26b0 into main Feb 9, 2022
@timtmok
timtmok deleted the bugfix/electron-menu-separators branch February 9, 2022 12:54
matheustavaresdev added a commit that referenced this pull request Feb 9, 2022
…on-test

* 'main' of github.com:rstudio/rstudio:
  Fix duplicate menu separators (#10533)
  use RSTUDIO_CLI_HYPERLIKNS env var
  Mention issue number in NEWS.
  stamp version into Electron app (macOS)
  fix NEWS
  fix NEWS year
  produce separate UTF-8 rsession binary for ucrt builds (#10524)
  Check if load from base is masked before calling load workspace
  alternate mechanism for R_ResetConsole on Windows (#10510)
  rotate news files (#10528)
  Move old NEWS versions in version/news subdirectory
  Change name back to NEWS.md
  Add RSW section
  Add version numbering to NEWS file to avoid further conflicts/overwrites
  Remove GO NEWS files
  NEWS for Spotted Wakerobin only
  Support ansi hyperlinks (#10416)
  Update to Quarto v0.3.114
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants