question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add option to have cancel be default action

See original GitHub issue

Currently setting reverseButtons: true does not reverse the behaviour of the space/enter key to click “cancel” instead of “confirm”. This means that pressing enter still uses the “confirm” button.

It would be nice to reverse this behaviour when reversing the button positions, so defensive behaviour can be the default in that case.

It looks like this behaviour primarily lives here: https://github.com/limonte/sweetalert2/blob/master/src/sweetalert2.js#L522-L523

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
birjjcommented, Aug 10, 2016

I too feel that we lack a way to change default behavior. It can be useful to have cancel be the default.

We should consider whether this should be bound to button order, though - people might want the default to be on the left/right depending on the rest of their system, so we might want to add it as another option.

1reaction
angineeringcommented, Aug 10, 2016

@limonte would it be an acceptable option to add a new parameter for reversing/changing default focused button?

Read more comments on GitHub >

github_iconTop Results From Across the Web

What to call "Cancel" when "Cancel" is already the default ...
My suggestion: never use the word "Cancel" in the default action. To cancel a subscription, you can, for example, say "Remove Subscription" ...
Read more >
how can i cancel the default action if user set my action as ...
1 Answer 1 ... Easy. Go to Settings -> Applications -> Manage Applications. Find the app that was set to default (For example,...
Read more >
What term to use for “Cancel” when “Cancel” is already the ...
If the default is “cancel,” the cancel button should be called something straightforward, such as “Don't cancel.” It is to be noted that...
Read more >
Browser default actions - The Modern JavaScript Tutorial
The main way is to use the event object. There's a method event.preventDefault() . If the handler is assigned using on<event> (not by ......
Read more >
Default Actions - Salesforce Help
Default actions are sets of predefined actions to get you and your users started using actions in your org. Add default actions to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found