-
Notifications
You must be signed in to change notification settings - Fork 33
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
Feature/enyo 4811 roysutton #1301
Conversation
Enact-DCO-1.0-Signed-off-by: Roy Sutton roy.sutton@lge.com
Enact-DCO-1.0-Signed-off-by: Roy Sutton roy.sutton@lge.com
Enact-DCO-1.0-Signed-off-by: Roy Sutton roy.sutton@lge.com
Enact-DCO-1.0-Signed-off-by: Roy Sutton roy.sutton@lge.com
Enact-DCO-1.0-Signed-off-by: Roy Sutton roy.sutton@lge.com
Enact-DCO-1.0-Signed-off-by: Roy Sutton roy.sutton@lge.com
Enact-DCO-1.0-Signed-off-by: Roy Sutton roy.sutton@lge.com
Enact-DCO-1.0-Signed-off-by: Roy Sutton roy.sutton@lge.com
Enact-DCO-1.0-Signed-off-by: Roy Sutton roy.sutton@lge.com
Enact-DCO-1.0-Signed-off-by: Roy Sutton roy.sutton@lge.com
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made some changes for LabeledItem
. Other than that everything looks good to me 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some initial comments/questions. Taking a deeper dive still.
this.cancelJob.stop(); | ||
} | ||
|
||
cancelJob = new Job(() => this.doCancel(), 30) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
30
seems like a magic number - what was the reasoning behind the specific value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a bit magical. It was supposed to be long enough to make it async but not so long that the user would notice a lag between unhovering/unspotting and the marquee stopping. It should be long enough that as the move they pointer between the different parts of a controlled set that it wouldn't reset. I was thinking 100-300ms was probably a reasonable number but 30 seems to work well in testing. It may be possible to go without it given the ordering of the events but I didn't want to rely on possibly unpredictable event ordering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎩 🐰
Admittedly feels a bit dirty...
@@ -44,7 +44,7 @@ describe('LabeledItem Specs', () => { | |||
}); | |||
|
|||
it('should have \'disabled\' HTML attribute when \'disabled=true\'', function () { | |||
const item = mount( | |||
const item = shallow( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming we couldn't do a shallow test here, there should be a cleaner way to write this test so that we aren't checking the specific number of elements (1) with a disabled
prop set to true
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @viodragon2
onFocus: this.handleFocus | ||
onFocus: this.handleFocus, | ||
// When picker button becomes disabled, it doesn't fire blur, but does fire | ||
// `onSpotlightDisappear`. We should investigate why `onBlur` does not fire |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any clues from facebook/react#9142 (comment)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting find! Could be related. Talked some with @germboy about it but we didn't reach any conclusions.
return null; | ||
}); | ||
if (!this.sync) { | ||
this.setState((prevState) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth throwing this into a fn?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:indeed:
@@ -26,10 +28,35 @@ const PickerButtonBase = kind({ | |||
spotlightDisabled: PropTypes.bool | |||
}, | |||
|
|||
defaultProps: { | |||
joined: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, not any longer since I removed forProp()
. Just forgot to clean it up.
@@ -299,6 +299,8 @@ const MarqueeDecorator = hoc(defaultConfig, (config, Wrapped) => { | |||
this.textDirectionValidated = false; | |||
} else if (next.marqueeOn !== marqueeOn || next.marqueeDisabled !== marqueeDisabled || next.marqueeSpeed !== marqueeSpeed) { | |||
this.cancelAnimation(); | |||
} else if (next.disabled && this.isHovered && marqueeOn === 'focus' && this.sync) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain how the marqueeOn === 'focus'
check helps in this scenario?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this scenario, we're checking for a transition to disabled when we were in 'focus' start. In this case, we could get a 'blur' event, which would cancel the marquee. Since we're hovered, we want to make sure the marquee continues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not to mention that we don't fire the 'enter' event when focused and enabled.
if (!this.anyRunning()) { | ||
this.dispatch('start'); | ||
} | ||
this.cancelJob.stop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to stop the job if we're hovered now? Will the job's fn exit early?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 We -could- rely on the job to run out and be trapped by the hover event. It seemed wiser to always clean up the job than to rely on logic elsewhere. I'm game for removing these extra ones.
if (!this.anyRunning()) { | ||
this.dispatch('start'); | ||
} | ||
this.cancelJob.stop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar question here as for handleEnter
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar answer here as for handleEnter
.
Enact-DCO-1.0-Signed-off-by: Roy Sutton roy.sutton@lge.com
Enact-DCO-1.0-Signed-off-by: Roy Sutton roy.sutton@lge.com
Enact-DCO-1.0-Signed-off-by: Roy Sutton roy.sutton@lge.com
Issue Resolved / Feature Added
Marquee would not continue or start in certain situations. Additionally,
Spottable
was notcorrectly forwarding
onMouseEnter
andonMouseLeave
.Resolution
Modify
MarqueeDecorator
to not start or stop its own marquee when controlled,deferring that instead to
MarqueeController
. Additionally, keep track of hover statusin
MarqueeDecorator
when enabled so we can keep the status when switching todisabled
.MarqueeController
is modified to add callbacks forenter
andleave
so it can track the hover state of controls. Also, added a delay before stopping
controlled marquee so that moving among controls does not cause stuttering
marquee. Finally, added some code to
PickerButton
to trap hover so we canstart marquee when hovering disabled buttons.
Additional Considerations
We may need a new qa sample to demonstrate controlled marquees that use
marqueeOn
focus
and disabledmarqueeOn
focus
components.Links
ENYO-4811
ENYO-4882
ENYO-4907
ENYO-4910
Comments