Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Popup: button class applied to Popup #1703

Closed
brianespinosa opened this issue May 25, 2017 · 4 comments
Closed

Popup: button class applied to Popup #1703

brianespinosa opened this issue May 25, 2017 · 4 comments

Comments

@brianespinosa
Copy link
Member

Steps

When creating a popup from a button with as an action prop from an Input, the .button class is being passed to the Popup which is giving it the text-align and hover styles of a button.

Expected Result

There should be no .button class on the .ui.popup that is being rendered.

Actual Result

A .button class is present on the rendered .ui.popup

Version

0.68.3

Testcase

http://codepen.io/anon/pen/BRbpWw

@brianespinosa
Copy link
Member Author

Don't worry about the positioning of the Popup in that codepen. I just used the open prop to set it as open by default so you can see the hover style that is being applied too.

@brianespinosa brianespinosa changed the title .button class is being added to Popup when a popup is rendered as an action prop of an Input bug(Popup) .button class is being added to Popup when a popup is rendered as an action prop of an Input May 25, 2017
@layershifter layershifter changed the title bug(Popup) .button class is being added to Popup when a popup is rendered as an action prop of an Input Popup: button class applied to Popup May 25, 2017
@levithomason
Copy link
Member

Adding more context here, all input actions require the button className. We currently set this as a default prop when creating the action:

Input.js

const actionElement = Button.create(action, { defaultProps: { className: 'button' } })

The intent here was to ensure that all actions had the required button class and therefore correctly rendered as a Button. However, we should remove the automatic button className in favor of requiring users to explicitly define their actions as buttons:

<Input action={<Button />} />
<Input action={<Dropdown button />} />

This would allow the Popup to render without a button className while the triggers would explicitly define themselves as valid actions (i.e. buttons).

Breaking Change

This would be a breaking change in that we'd now require Dropdown actions to explicitly define the button prop:

Before

<Input action={<Dropdown />} />

After

<Input action={<Dropdown button />} />

@tungurlakachakcak
Copy link

@levithomason As I understood the author suggests that the popup should not inherit the "button" class? Therefore is the solution above able to fix this? The change seems too big.

@levithomason
Copy link
Member

Yes, the solution will fix the the bug. It is a minimal change and inline with the direction of library, that is, less magic and more explicit props.

Note that the breaking change will only affect cases where the action shorthand value is an element (e.g. <Dropdown />). When passing a string, number, or props object a standard button will still be created with the proper classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants