Overview
Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
Learn to create accessible and functional modal dialogs using the native HTML dialog element in this comprehensive 31-minute tutorial. Master the fundamentals of the dialog element, including the differences between the .show() and .showModal() methods for opening dialogs. Discover how to implement proper closing functionality with buttons, handle autofocus behavior for better user experience, and ensure accessibility compliance for screen readers and keyboard navigation. Explore extensive styling techniques to overcome default user agent styles, prevent page scrolling when modals are open, and customize the backdrop appearance. Understand advanced concepts like applying flexbox or grid layouts only to opened states, identify specific use cases for the .show() method, and troubleshoot common positioning challenges that may arise during implementation.
Syllabus
- Introduction
- the basics of the dialog element
- opening the dialog with .show and .showModal
- adding a button to close the dialog
- dealing with autofocus
- make the close button accessible
- styling them - there are a lot of user agent styles!
- prevent the page from scrolling when a modal is opened
- styling the backdrop
- only add flex or grid on the opened state
- use case for the .show method
- overcoming positioning issues that you might run into
Taught by
Kevin Powell