-
Notifications
You must be signed in to change notification settings - Fork 14
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
Removing unnecessary menu items from the address bar field context menu #384
Conversation
Note: I will remove "Search with Google" right after my Xcode is updated |
@tomasstrba Maybe the entire bottom section of the menu should be removed? None of the actions in it seem very useful for the address bar, and several of the items don't work or make the address bar layout break (spelling and grammar > show spelling and grammar, subsitutions > data detectors, layout orientation > vertical). |
dd0b700
to
da1cf9e
Compare
Ben, agree. I removed everything except Services since it is managed elsewhere. Please see Services menu |
da1cf9e
to
d5cd41b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
private func removingAttributeChangingMenuItems(from menu: NSMenu) -> NSMenu { | ||
menu.items.reversed().forEach { menuItem in | ||
if let action = menuItem.action { | ||
if Self.selectorsToRemove.contains(action) { menu.removeItem(menuItem) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also probably need to return after the If
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean continue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am going to create else branch to make it more clear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, kinda.. May you also consider replacing the .forEach() with for each menuItem
? This would mean continue
usage 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continue and remove combination can be a bit missleading. How about now?
return removingAttributeChangingMenuItems(from: menu) | ||
} | ||
|
||
private static var selectorsToRemove = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's replace it with a Set
Task/Issue URL: https://app.asana.com/0/1148564399326804/1201546959960286
Description:
There was unnecessary "Make Link", "Search with Google" and "Fonts" menu items in the context menu of the address bar text field.
Steps to test this PR:
Internal references:
Software Engineering Expectations
Technical Design Template
When ready for review, remember to post the PR in MM