Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/components/NcActionButton/NcActionButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,6 @@ export default {
ChevronRightIcon,
ChevronLeftIcon,
},
setup() {
return {
isRtl,
}
},
mixins: [ActionTextMixin],

inject: {
Expand Down Expand Up @@ -462,6 +457,11 @@ export default {
default: null,
},
},
setup() {
return {
isRtl,
}
},

computed: {
/**
Expand Down
24 changes: 17 additions & 7 deletions src/components/NcActions/NcActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1179,12 +1179,15 @@
},

emits: [
'click',
'blur',
'focus',

'close',
'closed',
'open',
'opened',
'update:open',
'close',
'focus',
'blur',
'click',
],

setup(props) {
Expand Down Expand Up @@ -1471,10 +1474,17 @@
/**
* Called when popover is shown after the show delay
*/
onOpen() {
onOpened() {
Copy link
Contributor Author

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

this.$nextTick(() => {
this.focusFirstAction(null)
this.resizePopover()

/**
* Event emitted when the popover menu is opened.
*
* This event is emitted after `update:open` was emitted and the opening transition finished.
*/
this.$emit('opened')
Copy link
Contributor

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)

Copy link
Contributor

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

Copy link
Contributor

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 ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, was missing 🤷

})
},

Expand Down Expand Up @@ -1516,7 +1526,7 @@
return this.$refs.menu.querySelector('li.active')
},
/**
* @return {NodeListOf<HTMLElement>}

Check warning on line 1529 in src/components/NcActions/NcActions.vue

View workflow job for this annotation

GitHub Actions / NPM lint

The type 'NodeListOf' is undefined
*/
getFocusableMenuItemElements() {
return this.$refs.menu.querySelectorAll(focusableSelector)
Expand Down Expand Up @@ -1901,9 +1911,9 @@
},
on: {
show: this.openMenu,
'apply-show': this.onOpen,
'after-show': this.onOpened,
Copy link
Contributor

@susnux susnux Apr 2, 2025

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.

Copy link
Contributor Author

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:

  1. we start closing
  2. we are sure everything is finished and closed/hidden

hide: this.closeMenu,
'apply-hide': this.onClosed,
'after-hide': this.onClosed,
},
},
[
Expand Down
2 changes: 1 addition & 1 deletion src/components/NcAppNavigationNew/NcAppNavigationNew.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default {
validator(value) {
return ['primary', 'secondary', 'tertiary'].indexOf(value) !== -1
},
}
},
},

emits: ['click'],
Expand Down
2 changes: 1 addition & 1 deletion src/components/NcAvatar/NcAvatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ export default {
</docs>
<template>
<span ref="main"
:title="tooltip"
v-click-outside="closeMenu"
:title="tooltip"
:class="{
'avatardiv--unknown': userDoesNotExist,
'avatardiv--with-menu': hasMenu,
Expand Down
20 changes: 13 additions & 7 deletions src/components/NcPopover/NcPopover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ import NcPopoverTriggerProvider from './NcPopoverTriggerProvider.vue'
* @typedef {import('focus-trap').FocusTargetValueOrFalse} FocusTargetValueOrFalse
* @typedef {FocusTargetValueOrFalse|() => FocusTargetValueOrFalse} SetReturnFocus
*/

export default {
name: 'NcPopover',

Expand Down Expand Up @@ -239,6 +238,7 @@ export default {
data() {
return {
internalShown: this.shown,
animationDuration: 100,
}
},

Expand All @@ -254,6 +254,7 @@ export default {

mounted() {
this.checkTriggerA11y()
this.animationDuration = parseInt(getComputedStyle(this.$el).getPropertyValue('--animation-quick')) || 100
},

beforeDestroy() {
Expand Down Expand Up @@ -385,22 +386,27 @@ export default {
await this.useFocusTrap()
this.addEscapeStopPropagation()

setTimeout(() => {
Copy link
Contributor

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 })

Copy link
Contributor Author

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

/**
* Triggered after the tooltip was visually displayed.
*
* This is different from the 'show' and 'apply-show' which
* run earlier than this where there is no guarantee that the
* tooltip is already visible and in the DOM.
*/
this.$emit('after-show')
this.$emit('after-show')
}, this.animationDuration)
},
afterHide() {
async afterHide() {
this.clearFocusTrap()
this.clearEscapeStopPropagation()
/**
* Triggered after the tooltip was visually hidden.
*/
this.$emit('after-hide')

setTimeout(() => {
/**
* Triggered after the tooltip was visually hidden.
*/
this.$emit('after-hide')
}, this.animationDuration)
},
},
}
Expand Down
Loading