Barrier of the Week

The Modal Opened on Screen but Didn’t Exist for the Keyboard

Humira website showing a condition selector modal overlay open while JAWS screen reader output reveals keyboard focus remains on background page elements behind the modal.
Humira website showing a condition selector modal overlay open while JAWS screen reader output reveals keyboard focus remains on background page elements behind the modal.
<div role="dialog"     aria-modal="true"     aria-labelledby="modal-title"     tabindex="-1"     id="brand-modal">  <h2 id="modal-title">Important Safety Information</h2>  <!-- modal content here --></div>
const modal = document.getElementById("brand-modal");modal.focus();
triggerElement.focus();

    Why is keyboard accessibility important for modals?

    Keyboard accessibility ensures that users who don’t use a mouse can interact with modal dialogs, including reading content and completing required actions.

    What happens when focus doesn’t move into a modal?

    If focus stays on the background page, users may not know the modal opened and cannot interact with its content, making it effectively unusable.

    What is focus trapping in a modal?

    Focus trapping keeps keyboard navigation inside the modal while it’s open, preventing users from tabbing into background content.

    How can developers fix inaccessible modals?

    Move focus into the modal on open, trap focus within it, use proper ARIA attributes like aria-modal="true", and return focus to the trigger element when the modal closes.

    Humira website showing a condition selector modal overlay open while JAWS screen reader output reveals keyboard focus remains on background page elements behind the modal.
    <div role="dialog"     aria-modal="true"     aria-labelledby="modal-title"     tabindex="-1"     id="brand-modal">  <h2 id="modal-title">Important Safety Information</h2>  <!-- modal content here --></div>
    const modal = document.getElementById("brand-modal");modal.focus();
    triggerElement.focus();

      Why is keyboard accessibility important for modals?

      Keyboard accessibility ensures that users who don’t use a mouse can interact with modal dialogs, including reading content and completing required actions.

      What happens when focus doesn’t move into a modal?

      If focus stays on the background page, users may not know the modal opened and cannot interact with its content, making it effectively unusable.

      What is focus trapping in a modal?

      Focus trapping keeps keyboard navigation inside the modal while it’s open, preventing users from tabbing into background content.

      How can developers fix inaccessible modals?

      Move focus into the modal on open, trap focus within it, use proper ARIA attributes like aria-modal="true", and return focus to the trigger element when the modal closes.

      Human-led accessibility solutions that enable access for all

      We manually test forms and online services with real assistive technology, so the people who need to report a hazard actually can.

      Talk to our team →

      Make sure your forms work for everyone

      Tell us about your website or reporting system and we will get back to you with a no-obligation read on your accessibility risk.

      Get in touch →