Skip to content

refactor!: floating UI#1998

Merged
JammingBen merged 12 commits intomainfrom
refactor/floating-ui
Mar 3, 2026
Merged

refactor!: floating UI#1998
JammingBen merged 12 commits intomainfrom
refactor/floating-ui

Conversation

@JammingBen
Copy link
Member

@JammingBen JammingBen commented Feb 18, 2026

Replaces tippy.js with the more modern Floating UI. This results in some breaking changes when using the OcDrop component.

OcDrop breaking changes

  • The property popperOptions has been removed
  • The property target has been removed
  • The property offset is now supposed to be given as a single digit number and controls the vertical offset
  • The exposed method tippy has been removed
  • The component now expects a toggle even in manual mode.

Floating UI in general is more lightweight and much more similar to a JS native implementation. It basically offers you a set of helpers to position your floating element correctly, but you have to take care of things like event handling, showing/hiding the floating element etc.

closes #1929

@JammingBen JammingBen self-assigned this Feb 18, 2026
@JammingBen JammingBen added the Type:Maintenance E.g. technical debt, packaging, etc. label Feb 18, 2026
@JammingBen JammingBen force-pushed the refactor/floating-ui branch 2 times, most recently from 02d5569 to e4b0293 Compare February 18, 2026 15:03
@JammingBen JammingBen changed the title refactor: floating UI refactor!: floating UI Feb 18, 2026
@JammingBen JammingBen force-pushed the refactor/floating-ui branch 5 times, most recently from b34b96a to 1682559 Compare February 19, 2026 06:37
</oc-button>
<context-menu-quick-action
ref="contextMenuButtonRef"
:ref="(el: any) => (contextMenuDrops[item.id] = el?.drop)"
Copy link
Member Author

Choose a reason for hiding this comment

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

any cast can be removed when we switch to script setup. But I don't want to bloat this already big PR even more.

Comment on lines -66 to -79
it('should show the context menu on right click', async () => {
const groups = getGroupMocks()
const spyDisplayPositionedDropdown = vi.mocked(displayPositionedDropdown)
const { wrapper } = getWrapper({ mountType: mount, groups })
await wrapper.find(`[data-item-id="${groups[0].id}"]`).trigger('contextmenu')
expect(spyDisplayPositionedDropdown).toHaveBeenCalledTimes(1)
})
it('should show the context menu on context menu button click', async () => {
const groups = getGroupMocks()
const spyDisplayPositionedDropdown = vi.mocked(displayPositionedDropdown)
const { wrapper } = getWrapper({ mountType: mount, groups })
await wrapper.find('.groups-table-btn-action-dropdown').trigger('click')
expect(spyDisplayPositionedDropdown).toHaveBeenCalledTimes(1)
})
Copy link
Member Author

Choose a reason for hiding this comment

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

We can't unit test that the drop is being called because the ref to the drop element doesn't exist.

},

methods: {
cycleRoles(event: KeyboardEvent) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This was broken for the link role dropdown and other drop menus don't have this functionality, hence I decided to remove it.

expect(wrapper.html()).toMatchSnapshot()

expect(wrapper.findAll('#oc-files-context-menu > ul').length).toEqual(menuSections.length)
expect(wrapper.findAll('.oc-files-context-action-drop').length).toEqual(3)
Copy link
Member Author

Choose a reason for hiding this comment

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

Drop menus are not rendered initially anymore.

@JammingBen JammingBen marked this pull request as ready for review February 19, 2026 08:53
@JammingBen JammingBen requested a review from kulmann February 19, 2026 08:53
@JammingBen JammingBen force-pushed the refactor/floating-ui branch 7 times, most recently from f290db3 to 82fc531 Compare February 20, 2026 11:09
Copy link
Member

@kulmann kulmann left a comment

Choose a reason for hiding this comment

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

Oof size is large 😅 I didn't succeed in trying to trick the ui into weird drop positions. Wow, super nice!

Found one small thing... but debatable: when doing a right-click on a tile or row in the files app and then clicking the three-dots-button of the same element, the context menu doesn't re-render next to the three-dots-button but the already open context menu stays where it was opened via right click.

And additionally what you see in the comments. ;-)

@JammingBen JammingBen force-pushed the refactor/floating-ui branch from 82fc531 to 8915fa4 Compare March 3, 2026 09:00
@JammingBen JammingBen requested a review from kulmann March 3, 2026 13:31
Copy link
Member

@kulmann kulmann left a comment

Choose a reason for hiding this comment

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

nice one 🥳

@JammingBen JammingBen force-pushed the refactor/floating-ui branch from 3929875 to 3b22063 Compare March 3, 2026 15:31
@JammingBen JammingBen merged commit 7818604 into main Mar 3, 2026
28 checks passed
@JammingBen JammingBen deleted the refactor/floating-ui branch March 3, 2026 15:51
openclouders pushed a commit that referenced this pull request Mar 3, 2026
@openclouders openclouders mentioned this pull request Mar 3, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type:Breaking-Change Type:Maintenance E.g. technical debt, packaging, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace tippy.js with Floating UI

2 participants