Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Focusing with Tab iterates each radio button when in modal dialog #8186

Open
web-padawan opened this issue Nov 19, 2024 · 0 comments
Open

Focusing with Tab iterates each radio button when in modal dialog #8186

web-padawan opened this issue Nov 19, 2024 · 0 comments

Comments

@web-padawan
Copy link
Member

Description

When vaadin-radio-group is placed inside vaadin-dialog, the focus trap logic iterates over all vaadin-radio-button elements on Tab instead of leaving the group as expected (arrow keys are supposed to be used).

Expected outcome

Expected the focus to leave the group on first Tab similarly to how it's used outside the dialog.

Minimal reproducible example

<vaadin-dialog></vaadin-dialog>

<vaadin-button>Open dialog</vaadin-button>

<script type="module">
  import '@vaadin/dialog';
  import '@vaadin/button';
  import '@vaadin/radio-group';

  const dialog = document.querySelector('vaadin-dialog');

  dialog.renderer = (root) => {
    if (root.firstChild) {
      return;
    }
    root.innerHTML = `
      <vaadin-radio-group label="Travel class">
        <vaadin-radio-button value="economy" label="Economy"></vaadin-radio-button>
        <vaadin-radio-button value="business" label="Business"></vaadin-radio-button>
        <vaadin-radio-button value="firstClass" label="First Class"></vaadin-radio-button>
      </vaadin-radio-group>
    `
  };

  // Open first dialog
  const btn = document.querySelector('vaadin-button');
  btn.addEventListener('click', () => {
    dialog.opened = true;
  });
</script>

Steps to reproduce

  1. Open the dialog
  2. Press Tab multiple times

Environment

Vaadin version(s): v24

Browsers

Issue is not browser related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants