fix: make sure subcells in merged regions are hidden
Description
When cells are merged in spreadsheet, display: none is applied to the subcells. However, they can get overridden by other styles under some conditions. This PR adds !important to the style so that the cells remain hidden any time.
Fixes #7177
Type of change
- [x] Bugfix
- [ ] Feature
Checklist
- [x] I have read the contribution guide: https://vaadin.com/docs/latest/contributing/overview
- [x] I have added a description following the guideline.
- [x] The issue is created in the corresponding repository and I have referenced it.
- [x] I have added tests to ensure my change is effective and works as intended.
- [x] New and existing tests are passing locally with my change.
- [x] I have performed self-review and corrected misspellings.
With this change, the focus outline (+ handle) of the merged cell is broken.
I reverted the initial fix and applied a new one. In the Cell class, z-index of 1 is automatically applied to cells with text content. However, this should not be the case for sub-cells. The first sub-cell in a merged region still contains the text. Usually, this problem is hidden because initially the sub-cells are added to the DOM before the merged cell. When there are two cells with the same z-index, the last added cell is shown on top. However, when the sheet is scrolled, sometimes the sub-cell is removed and the merged cell still stays in the DOM. Scrolling back to the row, the sub-cell is added back to the DOM with the same z-index of 1. Since the sub-cell is the last added one in this case, it is shown on top.
The new solution seems much cleaner and appropriate. There are similar checks in the Cell class already, changing its style based on whether it is a sub-cell. The focus outline problem is also not present in this version.
Quality Gate passed
Issues
1 New issue
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
This ticket/PR has been released with Vaadin 23.5.16.