design-system-react icon indicating copy to clipboard operation
design-system-react copied to clipboard

Add checkProps to GlobalNavigationBarLink and MenuDropdown to warn folks if they don't use the right event prop

Open kevinparkerson opened this issue 10 years ago • 6 comments

I noticed that GlobalNavigationBarRegion has inconsistent prop names for the "onSelect" event in it's sub-components. GlobalNavigationBarLink is "onClick," while GlobalNavigationBarDropdown is "onSelect." These should probably both be one or the other for consistency purposes.

for example, this: https://github.com/salesforce-ux/design-system-react/blob/master/stories/global-navigation-bar/index.jsx#L49

compared to: https://github.com/salesforce-ux/design-system-react/blob/master/stories/global-navigation-bar/index.jsx#L55

kevinparkerson avatar Jul 23 '16 01:07 kevinparkerson

As a menu, the dropdown allows you to make a "selection" while a link is something you can "click." This is consistent with the native React events, though possibly we should consider naming the event onChange

tweettypography avatar Jul 23 '16 01:07 tweettypography

@tweettypography i see "possibly"

what else needs to be considered to make a decisive statement on this?

swilliamset avatar Jul 24 '16 19:07 swilliamset

It's a breaking API change, I'd need some pretty strong reasoning to switch to onChange from onSelect. Some native components throw both, I believe, so if someone has a need for that it's something that could be considered.

tweettypography avatar Jul 24 '16 19:07 tweettypography

I'm going to reopen and ask that this be dealt with via a propCheck that will yell at you if you use onClick or onSelect in the wrong spot in order to add clarity.

@swilliamset Sound good?

interactivellama avatar Jul 26 '16 15:07 interactivellama

I could see that being useful

tweettypography avatar Jul 26 '16 20:07 tweettypography

I'm going to call this read the documentation, unless someone wants to take it.

interactivellama avatar Apr 20 '18 06:04 interactivellama