Accessible Modal Dialogs -- A11ycasts #19

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 พ.ย. 2024

ความคิดเห็น • 58

  • @rgsimon
    @rgsimon 7 ปีที่แล้ว +11

    Rob, can you gist it or commit it to some repo? Thanks in advance.

  • @Oswee
    @Oswee 5 ปีที่แล้ว +2

    As well it looks like it is great to use tags for dialog and clone/append its content to document.body so it always will be at the top of the screen (no z-index issues).

  • @conceptualarts1
    @conceptualarts1 5 ปีที่แล้ว +14

    I wish you could make a full Udemy course

  • @neilosman4440
    @neilosman4440 7 ปีที่แล้ว +3

    Thanks Rob, great show.
    One other alternative is to set focus on the element itself. As role dialog is interactive, windows SR users cant navigate the a11y tree and there for all text should be communicated through to aria-describedby attribute.
    BTW, last time i checked, this inert polyfill failed to work with MS Edge

  • @russellabraham9208
    @russellabraham9208 4 ปีที่แล้ว

    Was hoping to see this one covered. Thank you. I emulate bootstraps modal for a fallback. The inner Article with role of document usually gets detected by the screen reader as if it was another page.

  • @stomperhk9107
    @stomperhk9107 3 ปีที่แล้ว +1

    If you guys want to make sure that the screen reader will read the alert dialog, don't forget to give focus to the first button inside the modal.

  • @stomperhk9107
    @stomperhk9107 3 ปีที่แล้ว +1

    I've heard that some old screen readers still show the alert modal content even if it has display: none...

  • @vivekpainyuli214
    @vivekpainyuli214 5 ปีที่แล้ว +2

    Will it work same on Angular application??

  • @christiane3032
    @christiane3032 6 ปีที่แล้ว

    How do you make a non modal dialog accessible, for example a cookie layer, or any other layer, that appears on screen, after loading the page? These layers cover content and I want to close them asap using the keyboard. But I don't want to navigate the whole page before I get to this cookie layer. Should I provide a keyboard shortcut to access the layer?

  • @MoreUniqueThanMost
    @MoreUniqueThanMost 7 ปีที่แล้ว +1

    Setting all non-dialog controls to inert, then setting them all back to non-inert. What if some of those controls are supposed to be inert already? You've now reset them all regardless...

  • @MarcoBiedermann
    @MarcoBiedermann 7 ปีที่แล้ว +2

    Nice explanation Rob, thanks. Just one question. Why did you not use the tag? Brings some accessibility features with it like close on ESC.

    • @luisbelm
      @luisbelm 7 ปีที่แล้ว

      Browser implementation for those features is minimal (I'm not sure but may be just Chrome implementing them?)
      Edited: Rob says near the end of the video that it's just Chrome and Opera that supports it.

    • @AlfonsoML
      @AlfonsoML 7 ปีที่แล้ว +1

      Even if not all the browsers support it, that hasn't stopped us from using other features in similar situations, and given that the fallback is that the dialog behaves just like the plain divs that he's already using, I fail to see the problem to use it instead.

    • @MarcoBiedermann
      @MarcoBiedermann 7 ปีที่แล้ว

      Thanks for your reply. I know browser support is not that great but you could use some polyfill to shim it.

    • @neilosman4440
      @neilosman4440 7 ปีที่แล้ว

      chrome and opera have partial implementations only. It would be a good idea to write/use a polyfill once one or more UA fully implement the spec

    • @MarcoBiedermann
      @MarcoBiedermann 7 ปีที่แล้ว

      There already is one by Google: github.com/GoogleChrome/dialog-polyfill

  • @GilGoldshlager
    @GilGoldshlager 7 ปีที่แล้ว

    Really like the idea of bringing back the focus to the previous active element on close, thanks :)

  • @venkatesanpoongavanam1201
    @venkatesanpoongavanam1201 5 ปีที่แล้ว

    Hey, Rob. If have a video in pop-up in the CTA button, Vedio plays automatically right? As per WCAG.

  • @_mball_
    @_mball_ 7 ปีที่แล้ว

    I've seen solutions that trap tab (and shift-tab) and manually direct focus inside the modal - is there a way to do that, and to to direct the next tab event to something outside the web content, or would inert be the only way to handle it?

  • @Lazharus666
    @Lazharus666 7 ปีที่แล้ว +1

    Awesome stuff!! I will think in accessibility in my next projects for sure. One question, What is the font are you using in the code editor? Thanks and cotinue bringing this essential content!

  • @NithinJune
    @NithinJune 9 หลายเดือนก่อน

    what about the new HTML dialog element? are these automatically applied when i use that or do i have to add them in myself

  • @djvesko
    @djvesko 7 ปีที่แล้ว

    Great! Just one think I don't like. The position: fixed. If for some reason the dialog gets super big or viewport is super small, there is no way to move it. If you use position: absolute, you can achieve fairly similar behaviour, with this edge case covered.

  • @nicolasparada
    @nicolasparada 7 ปีที่แล้ว

    Very useful component. Nice work as always, Rob. Thanks 👍

  • @jonathanhodgson3298
    @jonathanhodgson3298 7 ปีที่แล้ว

    How can you tell the screen reader to read the contents of the screenreader? I noticed that your screen reader read it but cant work out why from the JavaScript.

  • @jonathanhodgson3298
    @jonathanhodgson3298 7 ปีที่แล้ว

    Would you advise implementing similar techniques for a slide in menu?

  •  7 ปีที่แล้ว

    I think that you should also set previousActiveElement to null on dialog closing to let browser free it in case it is removed from DOM.

  • @shontent
    @shontent 5 ปีที่แล้ว

    Which WCAG SC violation it is? if a modal dialog is not accessible?

  • @Oswee
    @Oswee 6 ปีที่แล้ว

    Lets convert this to custom element. With best practices. Z-index for example. :) And what about native element? Whats the progress on implementation?

    • @llihak
      @llihak 4 ปีที่แล้ว

      about the native element, is there a planned video in this series about that? chromium browsers have the most support for it, and the chrome team have developed a polyfill so that would be a natural fit here. yes?

  • @rongsenng
    @rongsenng 7 ปีที่แล้ว

    Why remove the `click` and `keydown` event listeners when dialog closes?

  • @ronstephen
    @ronstephen 3 ปีที่แล้ว

    Why it is not showing when the window or tab is out of user focus??

  • @MarcelRobitaille
    @MarcelRobitaille 7 ปีที่แล้ว

    Are you using dialog polyfill?

  • @konstantinkkk8397
    @konstantinkkk8397 5 ปีที่แล้ว

    pls show how to implement carousel. It is also not easy

  • @tom8705m
    @tom8705m 7 ปีที่แล้ว

    Are you using the Apples voice over or the ChromeVox extension?

  • @zotavka
    @zotavka 7 ปีที่แล้ว

    Hey Rob, I'm using React in my project. How do I get inert to work with React and its virtual dom?

    • @zotavka
      @zotavka 7 ปีที่แล้ว

      Also worth pointing out, there is an open issue on the react GitHub regarding non-standard attributes. github.com/facebook/react/issues/140

    • @zotavka
      @zotavka 7 ปีที่แล้ว

      Cool. Thanks for the swift replies.

  • @monozkumar8170
    @monozkumar8170 6 ปีที่แล้ว

    Thanks

  • @ManvendraSK
    @ManvendraSK 4 ปีที่แล้ว

    The "Inert" spec should be implemented in browsers by default.

  • @stomperhk9107
    @stomperhk9107 3 ปีที่แล้ว +1

    Well, if a container has visibility: hidden (or display: none) all of tis children will not be able to receive focus.

  • @zay5872
    @zay5872 4 ปีที่แล้ว

    inert ain't working for me

  • @MaksymMinenko
    @MaksymMinenko 2 ปีที่แล้ว

    Where's the source code??

  • @AndrewBone
    @AndrewBone 7 ปีที่แล้ว +14

    But, but, but, flexbox 😖

    • @lytedev
      @lytedev 7 ปีที่แล้ว

      That was my thought... Anybody know why? browser support?

    • @AndrewBone
      @AndrewBone 7 ปีที่แล้ว

      This tends to be how I go about it (it's quite old now but can be JS free)
      jsfiddle.net

  • @shahidawan4906
    @shahidawan4906 3 ปีที่แล้ว +1

    Can someone share this dialog code or codepen link here ? so we can understand that logic

    • @webbae
      @webbae 2 ปีที่แล้ว

      yes would love to have the code....

  • @DJDavid98
    @DJDavid98 7 ปีที่แล้ว

    Oh god please don't promote the transform centering method, I've had people ask me why their dialog was getting blurry for no reason and it's because of that 100% of the time

    • @MeTRoD
      @MeTRoD 7 ปีที่แล้ว

      Yeah I know I've run into this problem as well. It mostly happens on Chrome though. It's probably the element landing on a sub-pixel position or something.

    • @neilosman4440
      @neilosman4440 7 ปีที่แล้ว

      Was not aware of that. Does it also happen with vh/vw units?

  • @michellejohnson3720
    @michellejohnson3720 7 ปีที่แล้ว +1

    my comment

  • @SonnyDarvishzadeh
    @SonnyDarvishzadeh ปีที่แล้ว

    The mouth clicks are unbearable. There are so many ways to prevent and treat it in post production!

  • @СадиСалоев-ц7ъ
    @СадиСалоев-ц7ъ 6 ปีที่แล้ว

    thanks