primefaces / primefaces/primereact

Dropdown: message triggered by "required" property is mispositioned

Open
#2,840 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Bug
Dominant language
CSS
Stars
8.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

When the "required" property of the Dropdown component is used, the Dropdown is not filled, and validation is triggered, the error message that results is incorrectly positioned (the hidden select seems itself not well placed and "too invisible" for the browser to find it).

Reproducer

https://codesandbox.io/s/elated-feather-13b4fm?file=/src/demo/DropdownDemo.js

PrimeReact version

8.0.1

React version

18.x

Language

ALL

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior
  1. Submit the first form
  2. See error message appear on the top-left corner of the viewport
  3. Open the dialog and submit the second form
  4. See error message in same erroneous position
Expected behavior

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodeSandbox reproducer and the Dropdown component's required-field validation behavior. Compare the first form with the dialog form, inspect how the hidden select is positioned, and confirm that validation messages no longer appear at the viewport's top-left corner in either case.

Written by the indexing model from the issue text.

Assessment

Tech stack
react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.