Skip to content

Comments

refactor!: floating UI#1998

Open
JammingBen wants to merge 6 commits intomainfrom
refactor/floating-ui
Open

refactor!: floating UI#1998
JammingBen wants to merge 6 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 6 times, most recently from 4888ff7 to f290db3 Compare February 20, 2026 10:52
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

1 participant