Allow configuration of close, cancel buttons on Dialog #203
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains updates to
Dialog
to address a couple of application use cases dealing with close and cancel buttons.Part of hypothesis/lms#3139
Related to / a dependency for hypothesis/lms#3106
Dialog with a close button but no cancel button
I want to be able to replace the
SidebarPanel
Panel
components in the client withDialog
for consistency and the nice focus routing thatDialog
provides:That UI renders a close button but does not render any buttons in the panel/dialog itself. Previous to these changes, the
Dialog
component would always automatically render both a close and a cancel button if anonCancel
(i.e. close callback) is provided. Now there is granular control via two new props:withCloseButton
andwithCancelButton
(which default totrue
such that default behavior is unchanged).Similarly, a modal with a cancel button but no close button
In LMS, the
OAuth2RedirectErrorApp
modals have a cancel button (it's labeled "Close" here but it is a "cancel button" from the perspective of the Dialog) but no close ("X") button:These changes support this.