Skip to content

Conversation

@hokolomopo
Copy link
Contributor

@hokolomopo hokolomopo commented Nov 19, 2025

When focusing the selection input in the chart side panel, changing tab would not close the selection input, even though the input isn't visible anymore.

It's because since 91c0583, changing the tab would keep the component mounted, only hiding it with d-none (to keep its state). Relying on the selection input onWillUnmount to reset the state is not enough.

We now rely on a useEffect that checks the input.offsetParent property, which is null when an ancestor has display: none.

Task: 5249165

Task: 5249165

review checklist

  • feature is organized in plugin, or UI components
  • support of duplicate sheet (deep copy)
  • in model/core: ranges are Range object, and can be adapted (adaptRanges)
  • in model/UI: ranges are strings (to show the user)
  • undo-able commands (uses this.history.update)
  • multiuser-able commands (has inverse commands and transformations where needed)
  • new/updated/removed commands are documented
  • exportable in excel
  • translations (_t("qmsdf %s", abc))
  • unit tested
  • clean commented code
  • track breaking changes
  • doc is rebuild (npm run doc)
  • status is correct in Odoo

@robodoo
Copy link
Collaborator

robodoo commented Nov 19, 2025

Pull request status dashboard

When focusing the selection input in the chart side panel, changing
tab would not close the selection input, even though the input isn't
visible anymore.

It's because since 91c0583, changing the tab would keep the component
mounted, only hiding it with `d-none` (to keep its state). Relying on
the selection input `onWillUnmount` to reset the state is not enough.

We now rely on a `useEffect` that checks the `input.offsetParent`
property, which is `null` when an ancestor has `display: none`.

Task: 5249165
@hokolomopo hokolomopo force-pushed the 19.0-fix-selection-input-unmount-adrm branch from a45ab1f to c039286 Compare November 19, 2025 07:57
// offsetParent should return the nearest positioned ancestor, or null if an ancestor has `display: none`
jest
.spyOn(HTMLElement.prototype, "offsetParent", "get")
.mockImplementation(function (this: HTMLElement) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

did you have a look at jsdom/jsdom#1261, the polyfill suggested seems to stick close to the spec I could see on MDN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants