primereact icon indicating copy to clipboard operation
primereact copied to clipboard

Warning: React does not recognize the `iconPosition` prop on a DOM element. (v10.8.3)

Open lekhnath opened this issue 1 year ago • 13 comments

Describe the bug

React does not recognize the iconPosition prop on a DOM element when iconPosition prop in IconField is used with AutoComplete component.

Reproducer

https://stackblitz.com/edit/vitejs-vite-o12afk

System Information

react: 18.3.1
primereact: 10.8.3
typescript: 5.6.2

Steps to reproduce the behavior

  1. Go to issue reproducer link
  2. Inspect the console.

Expected behavior

AutoComplete and IconField are not composable. We should be able to combine any React component with any other component seamlessly.

lekhnath avatar Sep 19 '24 05:09 lekhnath

Looks like the IconField just blindly puts the iconPosition on all child elements.

<div {...rootProps} ref={elementRef}>
                {Children.map(props.children, (child, index) =>
                    cloneElement(child, {
                        iconPosition: props.iconPosition
                    })
                )}
            </div>

melloware avatar Sep 19 '24 14:09 melloware

To let you know, I used IconField without autocomplete and I also have the bug. It was working in v10.8.0, but not in v10.8.3

Holgrabus avatar Sep 30 '24 21:09 Holgrabus

+1

Lerwox avatar Oct 04 '24 06:10 Lerwox

+1 my team and I are encountering this bug as well. We were using v10.7.0 and updated to v10.8.3 and both versions have the issue, which makes me think it was not this commit https://github.com/primefaces/primereact/commit/2bc9397a2d5cf12652839f105e267e5af2390626 from @gcko.

If someone can provide some points on how to proceed I'm happy to take a stab at fixing the issue and opening a PR.

makushline avatar Oct 23 '24 14:10 makushline

Well as i stated the code is right here: https://github.com/primefaces/primereact/blob/3dec07ff23191b509b3ae8f1dd65b3e7f1694b5e/components/lib/iconfield/IconField.js#L30-L40

Its blindly putting that field on ANY child not checking that its of a certain type.

melloware avatar Oct 23 '24 14:10 melloware

@melloware I don't follow. We were also getting the error message while using v10.7.0, which was before the commit in August that introduced that code, which suggests that that snippet is not the culprit.

makushline avatar Oct 24 '24 13:10 makushline

That code is only in two places IconField and InputIcon so its coming from one of those two spots...

melloware avatar Oct 24 '24 13:10 melloware

Any update on this? We still have this issue on:

react: 18 primereact: 10.9.1

deepsweech avatar Jan 28 '25 16:01 deepsweech

Still issue exist on

React 19 PrimeReact 10.9.2

Bastek333 avatar Feb 05 '25 10:02 Bastek333

I am also experiencing this issue.

  • React: 19
  • PrimeReact: 10.9.2
  • Next.js: 15.1.7

The warning appears even after removing iconPosition from my code. Is there any update on this issue?

xGsManco avatar Feb 11 '25 12:02 xGsManco

@xGsManco as you can see there is an open PR to fix it waiting on PrimeTek's review.

melloware avatar Feb 11 '25 12:02 melloware

@melloware , has PrimeTek managed to resolve the issue?

SteveMugo avatar Jun 16 '25 16:06 SteveMugo

@SteveMugo no the PR is here and assigned to PrimeTek: https://github.com/primefaces/primereact/pull/7447

If you need immediate assistance from PrimeTek i would request it through your PRO account.

melloware avatar Jun 16 '25 16:06 melloware