Skip to content

feat(pfSwitch): add pf-switch component - #73

Open
recrsn wants to merge 1 commit into
patternfly-webcomponents:masterfrom
recrsn:pf-switch
Open

feat(pfSwitch): add pf-switch component#73
recrsn wants to merge 1 commit into
patternfly-webcomponents:masterfrom
recrsn:pf-switch

Conversation

@recrsn

@recrsn recrsn commented Aug 15, 2017

Copy link
Copy Markdown
Contributor

@recrsn recrsn changed the title feat(switch): added basic functionality of pf-switch [WIP] feat(switch): added pf-switch component [WIP] Aug 16, 2017
@recrsn recrsn changed the title feat(switch): added pf-switch component [WIP] feat(pfSwitch): added pf-switch component [WIP] Aug 16, 2017
@recrsn
recrsn force-pushed the pf-switch branch 3 times, most recently from ea054c2 to 0eeee14 Compare August 16, 2017 19:21
Comment thread gulpfile.js
gulp.watch('app/*.html', ['build']);
gulp.watch('src/**/*.js', ['build']);
gulp.watch('src/**/*.html', ['build']);
gulp.watch('src/**/*.scss', ['build']);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for fixing this!

@priley86

Copy link
Copy Markdown
Contributor

this is looking good!!

@recrsn recrsn changed the title feat(pfSwitch): added pf-switch component [WIP] feat(pfSwitch): implement pf-switch component [WIP] Aug 29, 2017
@recrsn recrsn changed the title feat(pfSwitch): implement pf-switch component [WIP] feat(pfSwitch): add pf-switch component Aug 30, 2017
@mcarrano

Copy link
Copy Markdown

Reviewed your test page @agathver . The switches look good. Personally I like the animation turned on. Looks like this is an optional setting. Are there reasons we may want to turn off the animation? The only other thing I wanted to make sure of is that when the switch is to the right and the work "ON" is exposed, that's the ON state. From your test page I wasn't clear if that was intended to be the on or off state so please confirm whether we are thinking the same thing.

@recrsn

recrsn commented Aug 31, 2017

Copy link
Copy Markdown
Contributor Author

@mcarrano

Looks like this is an optional setting. Are there reasons we may want to turn off the animation?

It is a feature that is available with core pf. Personally I don't see any reason why anyone would disable the animation. We can make animated = true as default.

The only other thing I wanted to make sure of is that when the switch is to the right and the work "ON" is exposed, that's the ON state. From your test page I wasn't clear if that was intended to be the on or off state so please confirm whether we are thinking the same thing.

Yes. The state is what currently visible.

@mcarrano

Copy link
Copy Markdown

@agathver Thanks for your reply. Why don't we go ahead and make the animation default as 'animated = true' unless anyone has an objection.

@priley86

Copy link
Copy Markdown
Contributor

@agathver this PR looks excellent to me. Major kudos for getting this done so quickly, making the code concise, and showing all the different use cases.

@cdcabrera do you mind taking a second pass at this? I did not get a chance to review for accessibility. @agathver if you have a chance, please just confirm you are meeting a11y standards and adding aria-roles/aria-labels as needed.

@mcarrano @agathver i'm fine with animating by default. It should be possible to toggle this via an attribute for the consumer, but animating by default is expected i suppose.

@priley86
priley86 requested a review from cdcabrera August 31, 2017 13:49
@srambach

srambach commented Sep 1, 2017

Copy link
Copy Markdown

Nice options for this component.
On the switches with check boxes, the checkbox doesn't seem to alternate as the toggle does. Is this intended?
Also, just my 2 cents, but the slide feels backwards to me. When I click the toggle, I expect the selected piece to slide to the other side, not slide away off the edge.
One other nit - the third example under Custom Labels appears to have an extra 1px showing on the left edge in the "off" state. The Test at the bottom will get this also depending on the number of characters in the text options.

@recrsn

recrsn commented Sep 2, 2017

Copy link
Copy Markdown
Contributor Author

@srambach

On the switches with check boxes, the checkbox doesn't seem to alternate as the toggle does. Is this intended?

The switch and checkbox are connected with one-way binding. Toggling the switch will change the checkbox but not vice-versa.

Also, just my 2 cents, but the slide feels backwards to me. When I click the toggle, I expect the selected piece to slide to the other side, not slide away off the edge.

It is consistent with what is shown here: http://www.patternfly.org/pattern-library/widgets/

One other nit - the third example under Custom Labels appears to have an extra 1px showing on the left edge in the "off" state. The Test at the bottom will get this also depending on the number of characters in the text options.

I could not reproduce this. I tried with 5, 10 and 15 characters.

@srambach

srambach commented Sep 5, 2017

Copy link
Copy Markdown

I see the 1px blue line in Chrome only, and I am on a Mac. (Chrome Version 60.0.3112.113 (Official Build) (64-bit)) Firefox and Safari both look fine to me.
image

Pardon my ignorance on the binding of the checkbox to the toggle, but if the checkbox itself is clicked, the state of the checkbox never changes. This is intended behavior?

@mcarrano

mcarrano commented Sep 5, 2017

Copy link
Copy Markdown

We should clarify the purpose of the checkbox in the test page. I did not pay that much attention to what the checkbox was doing as I assumed this was only there to reflect the state change resulting from the toggling of the switch. But based on @srambach 's comments, this does seem confusing. @agathver can you clarify what you are trying to show here? If it's just to show the effect of clicking the switch, then maybe just a text field that toggles from On and Off would be better.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants