Fix and clean up modal dialog example #713
Closed
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 pull request addresses the following issues:
Clean up HTML:
<div>
element instead of<pre>
and<code>
elements.<q>
elements with regular double quote characters (i.e."
)</li>
closing elements in some placesClean up JavaScript:
focusAfterClosed
parameter because it isn’t used at all. This added unnecessary complexity to the example.focusFirst
parameter. Same reason as above.Fixed Layout Issue:
Removed the
div#base_window_layer
element wrapping the main content that was used to disable scrolling when any modal dialog is open.The new implementation disables scrolling on the root element as soon as one dialog is open and restores the original property as soon as all dialoges are closed.
This fixed a major visual discrepancy of the dialog example page layout compared to the appearance of all other example pages. Most notably, the main content wasn’t aligned to the left of the screen and the main scrollbar was rendered a couple of pixels inside the viewport instead of the viewport border.
Potential bug:
The following code looks broken.
aria.Utils.attemptFocus
:Is the last line supposed to be called inside the
catch
block? If not, what’s the purpose of the try-catch block if nothing happens?