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

Multiselect droprown does not focus to options when used in the dialog #5838

Open
muhtomakin opened this issue Jan 25, 2024 · 2 comments
Open
Labels
Component: Accessibility Issue or pull request is related to WCAG or ARIA

Comments

@muhtomakin
Copy link

muhtomakin commented Jan 25, 2024

Multiselect dropdown cannot be selectable when used in Dialog

import React, { useState } from 'react';
import { Button } from 'primereact/button';
import { Dialog } from 'primereact/dialog';
import { MultiSelect } from 'primereact/multiselect';

export default function MaximizableDemo() {
  const [visible, setVisible] = useState(false);
  const [selectedCities, setSelectedCities] = useState(null);
  const cities = [
    { name: 'New York', code: 'NY' },
    { name: 'Rome', code: 'RM' },
    { name: 'London', code: 'LDN' },
    { name: 'Istanbul', code: 'IST' },
    { name: 'Paris', code: 'PRS' },
  ];

  return (
    <div className="card flex justify-content-center">
      <Button
        label="Show"
        icon="pi pi-external-link"
        onClick={() => setVisible(true)}
      />
      <Dialog
        header="Header"
        visible={visible}
        maximizable
        style={{ width: '50vw' }}
        onHide={() => setVisible(false)}
      >
        <div className="card flex justify-content-center">
          <MultiSelect
            value={selectedCities}
            onChange={(e) => setSelectedCities(e.value)}
            options={cities}
            optionLabel="name"
            placeholder="Select Cities"
            maxSelectedLabels={3}
            className="w-full md:w-20rem"
          />
        </div>
      </Dialog>
    </div>
  );
}

This is the code block from primereact workspace. As you can see after open the dropdown it cannot reachable with keyboard because it creates the options block out of the dialog box. Is there any chance to fix this issue? I am using the old version of primereact but I also tried with the latest version. This issue is still there.

Reproducer

No response

PrimeReact version

9.6.3

React version

18.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

@muhtomakin muhtomakin added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 25, 2024
@melloware melloware added Component: Accessibility Issue or pull request is related to WCAG or ARIA and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jan 25, 2024
@melloware
Copy link
Member

Yep its definitely a Focus Trap bug.

@muhtomakin
Copy link
Author

It seems that with latest version this partially fixed. But there is still bug for this component. Once you use in dialog, you cannot close the dropdown panel. Escape will close the whole dialog. Once you open the dropdown you cant close in the dialog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Accessibility Issue or pull request is related to WCAG or ARIA
Projects
None yet
Development

No branches or pull requests

2 participants