This fixes a asymmetry in `ControlAcceleratorSupport` that causes a bug and 
also a test to fail (an existing `Disabled` test).

All `addAcceleratorsIntoScene` will register a listener on the 
`anchor.sceneProperty()`.
The anchor is:
- The `Node`
- The `TabPane` for a `Tab`
- The `Tree/TableView` for a `TableColumnBase`

Until this PR, the `removeAcceleratorsFromScene` sequence was sometimes 
inconsistent:
- For `Node`: 
  - Unregister the `sceneProperty` on `Node`
    - Then remove the accelerators from `Scene`
- For `Tab` -> Get `TabPane`
  - Then remove the accelerators from `Scene`
- For `TableColumnBase` -> Get `Tree/TableView`
  - Then remove the accelerators from `Scene`

Note how the "Unregister the `sceneProperty` on `Node`" (in this case on 
`TabPane`, and on `TableColumnBase`) step is completely missing for `Tab` and 
`TableColumnBase`, explaining the bug and failing test for only those cases.

---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

-------------

Commit messages:
 - 8268374: MenuItem's accelerator gets fired even when ContextMenu is set to 
null

Changes: https://git.openjdk.org/jfx/pull/2306/files
  Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=2306&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8268374
  Stats: 16 lines in 2 files changed: 0 ins; 11 del; 5 mod
  Patch: https://git.openjdk.org/jfx/pull/2306.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/2306/head:pull/2306

PR: https://git.openjdk.org/jfx/pull/2306

Reply via email to