Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add z-index to fixedRowsBottom #6269

Merged
merged 8 commits into from Oct 3, 2019
Merged

Add z-index to fixedRowsBottom #6269

merged 8 commits into from Oct 3, 2019

Conversation

pnowak
Copy link
Contributor

@pnowak pnowak commented Sep 17, 2019

Context

After added z-indexes to selection borders (class .current, .area and .fill), and after scroll over fixedRowsBottom selection borders overlap to fixed area.
Honestly, z-index: 12 is enough to .ht_clone_bottom class. But I decided to use the existing place (clones class) and values to keep it easier to manage.

How has this been tested?

I tested with different cell types.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature or improvement (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Additional language file or change to the existing one (translations)

Related issue(s):

  1. [5.0.1+] Selection is covering on the fixed bottom rows #5947
  2. [2.0.0+] Open editor overlaps elements in clone top element #5105

Checklist:

  • My code follows the code style of this project,
  • My change requires a change to the documentation.

@wojciechczerniak
Copy link
Contributor

I know this is out of the scope for the linked issue, but while we're near z-indexes for overlays there is one more issue when there is more fixed bottom rows:

https://jsfiddle.net/tohnkvsd/

obraz

It's because .ht_clone_bottom_left_corner and .ht_clone_top_left_corner have the same z-index but bottom one is later in DOM structure. We should split those two and set z-index: 108 for the top header.

And BTW. if I remember correctly @budnix removed debug overlay. Can we clean up .ht_clone_debug class from CSS @budnix ?

@pnowak pnowak assigned pnowak and unassigned wszymanski Sep 18, 2019
@pnowak
Copy link
Contributor Author

pnowak commented Sep 18, 2019

Do we want this appearance?
Zrzut ekranu 2019-09-18 o 12 17 08

@wojciechczerniak
Copy link
Contributor

No. Header should be always at the top.

@pnowak pnowak assigned wszymanski and pnowak and unassigned pnowak and wszymanski Sep 18, 2019
@pnowak pnowak assigned wszymanski and unassigned pnowak Sep 18, 2019
@warpech
Copy link
Member

warpech commented Sep 20, 2019

I think that this PR is a good occasion to change src/editors/_baseEditor.js to set zIndex using a CSS class instead of inline style. This will help to cement the behavior and make it clearer where does it come from.

For example, there could be classes:

.displayLayer--low {
 z-index: 101;
}

.displayLayer--medium {
 z-index: 102;
}

.displayLayer--high {
 z-index: 103;
}

And then just add these classes dynamically on .ht_clone_* and .handsontableInputHolder. WDYT?

@pnowak pnowak assigned wszymanski and unassigned pnowak Sep 26, 2019
@wojciechczerniak
Copy link
Contributor

@warpech There's a lot more z-indexes that we have to cover.

z-index feature
999 editor ui
1x4 editor input
1x3 floating objects
1x2 selection
1x1 custom borders
1x0 overlay

Where x is an overlay

z-index overlay
180 top left corner
170 top right corner
160 top
150 bottom left corner
140 bottom right corner
130 bottom
120 left
110 right
100 master

Features like borders, selection, floating object and editors should hide under the fixed overlays that are above the layer the feature is located on.

@warpech
Copy link
Member

warpech commented Sep 26, 2019

I am glad to hear that. This means that there should never be two elements with the same zIndex anymore, right?

Anyway, my point was that it would improve the code quality to cover all these combinations using CSS class names, and never set style.zIndex directly in code.

It seems to me that this style was implemented in dd7c131, so I am happy now 😊

@@ -371,20 +371,28 @@ class BaseEditor {
*
* @returns {string}
*/
getEditedCellsZIndex() {
getEditedCellsZIndexClass() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This method is not used anywhere? Then we should remove unused code.

I'm not sure if the classes here are correct. They would give the editor same z-index as overlay.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now, this method isn't used because we decided to permanent z-index for editor in every overlay.
We will use it in the next step when we implement separate editor UI for editor input. This method has only one goal - return appropriate overlay sections to the editor. And then we are going to add 4 to base z-index.

Copy link
Contributor

@wszymanski wszymanski left a comment

Choose a reason for hiding this comment

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

Please take a look at how the editor looks like.

editor

edit: I'm sorry, it works. The first click shouldn't open the editor.

z-index: -1;
}

.ht_editor_show {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would call this class as ht_editor_shown.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe "visible" would be better?

@@ -585,21 +585,48 @@ CheckboxRenderer
background: #eee;
}

.ht_clone_top {
z-index: 101;
.ht_editor_hide {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would call this class as ht_editor_hidden.

arrayFilter(childNodes, (childNode) => {
if (hasClass(childNode, 'handsontableEditor')) {
hasClassHandsontableEditor = true;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe use:

  • Array.find or
  • rangeEach with returning false when the class will be found (It would break the loop.).

if (iteratee(index) === false) {
break;
}

For me, arrayFilter isn't the best choice.

@@ -66,6 +68,10 @@ class SelectEditor extends BaseEditor {
close() {
this._opened = false;
this.select.style.display = 'none';

if (hasClass(this.select, 'ht_editor_show')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe all those used classed could be moved to constants on the top of the file or event to the helper?

* @private
* @type {string}
*/
this.zIndexClass = void 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

I would call this variable as layerClass or similarly. For me, it would better call the described being, not just it's feature.

@wszymanski wszymanski assigned pnowak and unassigned wszymanski Sep 30, 2019
@pnowak pnowak assigned wszymanski and unassigned pnowak Oct 1, 2019
@wszymanski wszymanski assigned pnowak and unassigned wszymanski Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants