This repository has been archived by the owner on Sep 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 376
In MenuItem, don't override className prop, but extend it #293
Comments
Meanwhile, a workaround is to wrap the const MenuItemWithClassName = props => (
<MenuItem {...props} attributes={{ className: props.className }} />
); |
Good catch!. This library was written when CSS-in-JS libraries were not a thing. Now that they are a thing, it should be taken care of. Will you be willing to submit a PR? |
I can have a look during the weekend. |
wuppious
added a commit
to wuppious/react-contextmenu
that referenced
this issue
Sep 1, 2019
@vkbansal PR is done, however it fails due to Code Climate config error. I don't believe I can affect that, so please check into it. |
No issues. I'll take care of it
…On Sun, Sep 1, 2019, 5:41 PM Nico Nysten ***@***.***> wrote:
@vkbansal <https://github.com/vkbansal> PR is done, however it fails due
to Code Climate config error. I don't believe I can affect that, so please
check into it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#293?email_source=notifications&email_token=ABNH234BOLZ7OW5IVT4WCLLQHOWQFA5CNFSM4ISB6QSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5UBBPQ#issuecomment-526913726>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABNH23YQZEXWXMEQHHF7KBDQHOWQFANCNFSM4ISB6QSA>
.
|
erjstar
added a commit
to erjstar/react-contextmenu
that referenced
this issue
Apr 28, 2022
…ing (#294) * fix: linter errors and warnings * feat: extend MenuItem className correctly Closes vkbansal/react-contextmenu#293
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Currently, you can give
MenuItem
classNames through theattributes
prop. These are then applied to the element, but also overriding any className given as a direct prop.react-contextmenu/src/MenuItem.js
Lines 56 to 65 in 22d299e
The reason why this might be problematic, is that some css-in-js libraries such as
styled-components
apply an automatically generated className to the props, which then gets overridden in the render method.My suggestion would be to accept this className prop and extend it instead of overriding.
The text was updated successfully, but these errors were encountered: