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

Reassign Ctrl/Cmd + C default hotkey to copy clean urls #16764

Merged
merged 2 commits into from
Jan 25, 2023

Conversation

spylogsster
Copy link
Contributor

@spylogsster spylogsster commented Jan 20, 2023

Resolves brave/brave-browser#26761

Copy Clean Link is default for urls:
image

Copy text:
Win:
image

Mac:
image

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run lint, npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

  • Select url in the address bar and check context menu for the address bar, it should show default hotkey Ctrl+c for Copy clean link item, try to press Ctrl+c hotkey, it should strip parameters due to copy clean link database. Selecting Copy item from context menu should copy selected url without changes.
  • Select text (not url) in the address bar and check context menu for the address bar, it should show default hotkey Ctrl+c for Copy item, Copy clean link should not be visible

Copy link
Member

@goodov goodov left a comment

Choose a reason for hiding this comment

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

lgtm.

@spylogsster spylogsster force-pushed the brave-26761-omnibox branch 2 times, most recently from 1fa541c to 1c1cca6 Compare January 20, 2023 14:55
@fmarier
Copy link
Member

fmarier commented Jan 20, 2023

Is there a way to hide "copy clean link" entirely when the selection is just text and not a URL?

])");
const std::string test_url(
"https://dev-pages.bravesoftware.com/clean-urls/"
"exempted/"
Copy link
Member

Choose a reason for hiding this comment

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

It's a little weird to be using exempted/ in these test cases because the JSON config we supply here does not in fact exempt this URL.

I'd suggest removing /exempted/ in these three new test cases to reduce potential confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@github-actions
Copy link
Contributor

⚠️ PR head is an unsigned commit
commit: 8e8935b36851c1268adb7d64397649172f2192e9
reason: unsigned
Please follow the handbook to configure commit signing
cc: @invalid-email-address

1 similar comment
@github-actions
Copy link
Contributor

⚠️ PR head is an unsigned commit
commit: 8e8935b36851c1268adb7d64397649172f2192e9
reason: unsigned
Please follow the handbook to configure commit signing
cc: @invalid-email-address

@spylogsster
Copy link
Contributor Author

spylogsster commented Jan 22, 2023

Is there a way to hide "copy clean link" entirely when the selection is just text and not a URL?

discussed in Slack, it is hidden when simple text selected, updated screenshots in the description

@github-actions
Copy link
Contributor

⚠️ PR head is an unsigned commit
commit: 15c7cc51edeaf811277337c932ed6171e8307445
reason: unsigned
Please follow the handbook to configure commit signing
cc: @spylogsster

Copy link
Member

@simonhong simonhong left a comment

Choose a reason for hiding this comment

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

++

Comment on lines +61 to +62
bool is_url = const_cast<BraveOmniboxViewViews*>(this)->SelectedTextIsURL();
if (is_url) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
bool is_url = const_cast<BraveOmniboxViewViews*>(this)->SelectedTextIsURL();
if (is_url) {
if (SelectedTextIsURL()) {

@spylogsster spylogsster merged commit a49f373 into master Jan 25, 2023
@spylogsster spylogsster deleted the brave-26761-omnibox branch January 25, 2023 04:55
@github-actions github-actions bot added this to the 1.49.x - Nightly milestone Jan 25, 2023
@smehrjerdian
Copy link

I don't understand why this feature was added to the latest version? Why would we want to copy the clean link when using the basic CMD + C shortcut for copying text off a page?

You can see here the community considers it a bug? Is there a way for us to revert this behavior back to the default behavior we are all used to of CMD+C copying text?

https://community.brave.com/t/keyboard-shortcuts-cmd-c-copy-clean-link-issue/477306

@smehrjerdian
Copy link

Is there a way to hide "copy clean link" entirely when the selection is just text and not a URL?

I agree with this suggestion? why would we want to copy the clean link when we are highlighting text and clearly trying to copy the text not the URL? I now have to use control + C to copy text and cmd + V to paste it?

@fmarier
Copy link
Member

fmarier commented Mar 20, 2023

@smehrjerdian We will be fixing the bugs that users are running into in a hotfix coming shortly (likely in a day or two).

Additionally, we are working on a feature flag that will let users restore the default keyboard shortcuts: brave/brave-browser#29177 A proper UI setting will come later.

@smehrjerdian
Copy link

Amazing thanks for the update @fmarier

@sbusso
Copy link

sbusso commented Mar 23, 2023

This is a substantial UX change from the universal behavior of cmd+c, which should copy the selected content. I have been wondering for a few days why I got the correct content copied. I understand some users would like a shortcut to copy the link cleanly, but the default behavior of cmd+c should not be changed.

@0xhashmap
Copy link

0xhashmap commented Mar 30, 2023

This is still an issue with the new update. The only time cmd+c works properly is when first loading a page or refreshing. If you're navigating around and copy something, the stupid clean link thing happens. This is the most annoying behavior ever. I can't believe someone thought this was a good idea.

@fmarier
Copy link
Member

fmarier commented Mar 30, 2023

@0xhashmap What version of the browser are you using? 1.49.132 is the one that has cmd+C mapped to regular copy.

@0xhashmap
Copy link

I updated a few days ago, but I guess 1.49.132 was released since. I'm now on the latest version. Looks like it's fixed. Thank you.

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.

Assign Copy keyboard shortcut to "copy clean link"
7 participants