Page MenuHomePhabricator

FloatingUI: Investigate performance improvements
Open, Needs TriagePublic

Description

Background

T346099 covers implementing basic positioning of menus via FloatingUI in 3 components:

  • Select
  • Combobox
  • Lookup

This will be done in an internal composable, useFloatingMenu, so it can be applied to future menu components as well.

This task covers investigating and implementing performance improvements for this new functionality.

Implementation details

Notably, FloatingUI's autoUpdate feature seems to be triggered on scroll even when a menu is not open, causing it to recalculate the menu's position. Ideally, these calculations would not be made for invisible menus.

There may be other opportunities for performance enhancements as well.


Acceptance criteria

  • Investigate potential performance improvements
  • Implement them as necessary

Event Timeline

Notably, FloatingUI's autoUpdate feature seems to be triggered on scroll even when a menu is not open, causing it to recalculate the menu's position. Ideally, these calculations would not be made for invisible menus.

This was resolved in the code review phase before https://gerrit.wikimedia.org/r/953740 was merged.

I'm not sure what other performance improvements we could consider. I did notice that when a menu is opened, its styles are updated twice (I think that's because the watcher is called once for menuVisibility changing and then again for floatingStyles changing), but that only happens on open so I don't think it's that big of a deal.