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

onOk and onCancel #39

Open
midenarif opened this issue Jul 29, 2018 · 4 comments
Open

onOk and onCancel #39

midenarif opened this issue Jul 29, 2018 · 4 comments

Comments

@midenarif
Copy link

Please provide onOk and onCancel as optional and developer will select any one of them. Because sometimes we need an option to close dialog when user clicks only OK button

@hectahertz
Copy link
Owner

Hi @midenarif,

This is something that has been requested in the past and it wasn't really recommended in the Material Design guidelines.

The guidelines now cover this so if you wanna come up with an implementation that matches the specification I'd happily accept a PR for it 🙂

@peacechen
Copy link

There are cases where only a single button is needed. For example, my app pops up a dialog to notify the user if the internet connection has dropped. The only button needed is an acknowledgement.

Indeed, Google's Material Design guidelines state the same thing about acknowledgement actions.

Acknowledgement actions
When user acknowledgement is required to proceed, a single action may be presented. Alternatively, use a snackbar to communicate this type of information.

https://material.io/design/components/dialogs.html#actions

I think it's important to note Google's choice of name: Material Design guidelines, and not laws. Guidelines are a starting point and cover general cases, but not every single case. Thus it would be better to treat the guidelines less rigidly. There are obvious use cases for a single button dialog regardless of what Google explicitly states. There may even be oddball cases where 3 buttons are needed (I would discourage that, but could see it needed in rare cases).

@rafucisneros
Copy link

I opened a Pull Request #59 for this, is quite simple, please review it! @hectahertz

@paulpv
Copy link

paulpv commented Oct 22, 2020

There are cases where no button is also acceptable.

  1. Touch a button to show a list
  2. Select from the list
  3. Profit

This is the exact sequence that happens in a Picker/Dropdown.
They don't ask you to confirm the selection.
It should be perfectly fine to have cases where it is not necessary to have any confirmation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants