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

fix(angular): allow default browser action on CTRL+Click #24440

Closed

Conversation

Juarrow
Copy link
Contributor

@Juarrow Juarrow commented Dec 17, 2021

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally and any changes were pushed
  • Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue Number: #24413

What is the new behavior?

  • Allow CTRL/Meta + Click to be handled by the browser (e.g. for opening a link in a new tab)

Does this introduce a breaking change?

  • Yes
  • No

Other information

@Juarrow Juarrow requested a review from a team as a code owner December 17, 2021 23:16
@github-actions github-actions bot added the package: angular @ionic/angular package label Dec 17, 2021
@Juarrow
Copy link
Contributor Author

Juarrow commented Dec 17, 2021

  1. Do i have to add to add changes in package-lock.json-files to my commit too (after running npm run build)? (that's why i did not tick that checkmark)
  2. I kept the "old" behavior for <ion-button>. I think this makes more sense for something that is supposed to be a button. What is your opinion?

@sean-perkins
Copy link
Contributor

Hello @Juarrow thanks for this PR!

You do not need to commit package-lock.json changes. These are likely a result of running npm i instead of npm ci when cloning/setting-up the project. ci will install versions from the lock, where as install will attempt to install any new package versions based on the format in the package.json.

I think maintaining the existing ion-button behavior is appropriate. We can always make that change in a new minor release.

@sean-perkins sean-perkins changed the title fix(router-link-delegate): allow default browser action on CTRL+Click fix(angular): allow default browser action on CTRL+Click Jan 5, 2022
if (!this.elementRef.nativeElement.closest('ion-button')) {
// In case of CTRL+Click or Meta+Click,
// ignore those to allow default browser actions.
if (this.platform.is('desktop') && ev instanceof MouseEvent) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to check if the device is on desktop/a MouseEvent?

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed this appears to be redundant. The native click event is a MouseEvent. I'd advocate we remove the platform check to additionally handle tablet with a connected keyboard & mouse.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oftentimes, I tend to be too defensive with all the checks.

Will remove the if-statement.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Juarrow let me know when you have a moment to update the PR with this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sean-perkins just did. Also updated the commit message scope to reflect your change to the PR title.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@Juarrow this task is in my sprint to both finish out and address this PR. The main issue effects each framework output. After looking deeper at ion-button, I would like to address to inconsistencies with that component (no action required on your end).

Here's my WIP branch: https://github.com/ionic-team/ionic-framework/tree/FW-432 that pulls in your Angular change and applies a similar resolution to React and Vue.

Once I am able to diagnose the ion-button behavior fully and add respective tests, I will likely open a new PR and give you co-author credit on the PR.

@sean-perkins
Copy link
Contributor

Closing this PR in favor of: #25014. I did give you co-authored-by credit for the commit. Appreciate the help here! Community PR contributions is still an area we are actively trying to improve on. We are trying to tackle the older PRs first, as they are often times the hardest PRs to evaluate. Our time to reply can definitely be improved 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: angular @ionic/angular package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants