Skip to content

Dialog: ignores focusOnShow={false} when showHeader={false} #6825

@adrianhurt

Description

@adrianhurt

Describe the bug

When a Dialog has the prop showHeader to false, the focusOnShow is ignored when is set to false, so it will always be focused. This is specially annoying for the case that the first input is a Calendar, because it is focused even before showing the Dialog, so the Calendar's overlay is placed behind the Dialog on the top-left corner. It can be seen on the reproducer

<Dialog
    showHeader={false}
    focusOnShow={false}
    ...
>
    <Calendar value={date} onChange={(e) => setDate(e.value)} />
</Dialog>

Reproducer

https://stackblitz.com/edit/pys2ri?file=src%2FApp.jsx

PrimeReact version

latest

React version

18.x

Language

ES6

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

It should not auto-focus the first input when showOnFocus={false}.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugIssue contains a defect related to a specific component.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions