-
Notifications
You must be signed in to change notification settings - Fork 95
feat(NcActions): add opened and closed events to handle closing/opening end | fix(NcPopover): correctly wait for animation end in after-show/after-hide events
#6683
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
Conversation
| * Called when popover is shown after the show delay | ||
| */ | ||
| onOpen() { | ||
| onOpened() { |
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.
Only renamed for consistency with the onClosed method name
Signed-off-by: skjnldsv <[email protected]>
Signed-off-by: skjnldsv <[email protected]>
ed4b48d to
8c997ce
Compare
| await this.useFocusTrap() | ||
| this.addEscapeStopPropagation() | ||
| setTimeout(() => { |
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.
Instead of reading a CSS variable and adding a new task with timeout, can we use a native event here?
this.getPopoverContentElement().addEventListener('transitionend', () => {
this.$emit('after-show')
}, { once: 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.
Love it yeah! Didn't realized transitionend was an option
| * | ||
| * This event is emitted after `update:open` was emitted and the opening transition finished. | ||
| */ | ||
| this.$emit('opened') |
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.
Feature not fix (new event)
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.
Fix for NcPopover, feat for NcActions
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.
but the fix in ncpopover is unrelated to the feature for NcActions.
So this is semantically a feature PR ;)
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.
Yeah, was missing 🤷
|
/backport to next |
| on: { | ||
| show: this.openMenu, | ||
| 'apply-show': this.onOpen, | ||
| 'after-show': this.onOpened, |
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.
This will now run quite late.
after-show will already await the next tick and the focus trap, so the additional tick in onOpened will cause a 1 tick delay which seems to not be needed. Probably the nextTick in onOpened can be removed.
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.
I think it's best to stay consistent. I'd like to avoid to have three different timings to watch for.
Two are perfectly fine:
- we start closing
- we are sure everything is finished and closed/hidden
opened event / [NcPopover] animation wait
susnux
left a 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.
Not sure about the additional tick we now have, but in general makes sense
Was still testing this, let me push a followup if it works ⌛ |
opened event / [NcPopover] animation waitopened and closed events to handle closing/opening end | fix(NcPopover): correctly wait for animation end in after-show/after-hide events
|
A bit renamed for change log generation |
|
@ShGKme tested
|
|
Doesn't matter, much cleaner anyway |
|
@skjnldsv On my test: So it's 13ms longer, than timeout, but the animation might also have started later, than we think in the timeout |


NcAcions
Following #6065
The evets are
after-hideandafter-show, notapply-hideandapply-showhttps://github.com/nextcloud/nextcloud-vue/blob/ae77137aee5097dcbe8cef6c53eb1ce3bc81c7ee/src/components/NcPopover/NcPopover.vue#L230-L237
NcPopover
The vue-floating lib does not properly compute how long it needs to wait to know the popup have been shown/hidden.
I investigated and it's only using
requestAnimationFramewhich in that case isn't enough to ensure its completion.Because we have our own custom animation variables, we need to manually check for it ourselves.
Tested on Server with log entries to see the duration (we use
--animation-quickwhich is 100ms for us)