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

[FIX] headers_overlay: unhide cols/rows icon position broken #3733

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 0 additions & 9 deletions src/components/headers_overlay/headers_overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,6 @@ css/* scss */ `
height: 10000px;
background-color: ${SELECTION_BORDER_COLOR};
}
.o-unhide-buttons {
width: fit-content;
gap: 5px;
transform: translate(-50%, 0);
}
.o-unhide:hover {
z-index: ${ComponentsImportance.Grid + 1};
background-color: lightgrey;
Expand Down Expand Up @@ -537,10 +532,6 @@ css/* scss */ `
height: 1px;
background-color: ${SELECTION_BORDER_COLOR};
}
.o-unhide-buttons {
height: fit-content;
transform: translate(0, -50%);
}
.o-unhide:hover {
z-index: ${ComponentsImportance.Grid + 1};
background-color: lightgrey;
Expand Down
66 changes: 30 additions & 36 deletions src/components/headers_overlay/headers_overlay.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,22 @@
t-as="hiddenItem"
t-key="hiddenItem_index">
<div
class="o-unhide-buttons position-relative float-end"
class="position-absolute end-0 translate-middle-y"
t-att-style="getUnhideButtonStyle(hiddenItem[0])">
<t t-if="!hiddenItem.includes(0)">
<div
class="o-unhide rounded mb-1"
t-att-data-index="hiddenItem_index"
t-on-click="() => this.unhide(hiddenItem)">
<t t-call="o-spreadsheet-Icon.TRIANGLE_UP"/>
</div>
</t>
<t
t-if="!hiddenItem.includes(env.model.getters.getNumberRows(env.model.getters.getActiveSheetId())-1)">
<div
class="o-unhide rounded"
t-att-data-index="hiddenItem_index"
t-on-click="() => this.unhide(hiddenItem)">
<t t-call="o-spreadsheet-Icon.TRIANGLE_DOWN"/>
</div>
</t>
<div
class="o-unhide rounded mb-1"
t-att-class="{'invisible': hiddenItem.includes(0)}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason to change the t-if to invisible class ? Does it break the style with t-if ?
It's best to use t-if to avoid building the DOM (to make it invisible afterward)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any reason to change the t-if to invisible class ? Does it break the style with t-if ?

Yes, there is. If the icon is positioned on the first or last row/column, it won't have one of the icons, leading to a misalignment.

I attempted to resolve this by adding some pixels, but then ADRM proposed using the invisible class instead. You can find the discussion here.

t-att-data-index="hiddenItem_index"
t-on-click="() => this.unhide(hiddenItem)">
<t t-call="o-spreadsheet-Icon.TRIANGLE_UP"/>
</div>
<div
class="o-unhide rounded"
t-att-class="{'invisible': hiddenItem.includes(env.model.getters.getNumberRows(env.model.getters.getActiveSheetId())-1)}"
t-att-data-index="hiddenItem_index"
t-on-click="() => this.unhide(hiddenItem)">
<t t-call="o-spreadsheet-Icon.TRIANGLE_DOWN"/>
</div>
</div>
</t>
</div>
Expand Down Expand Up @@ -101,25 +98,22 @@
t-as="hiddenItem"
t-key="hiddenItem_index">
<div
class="o-unhide-buttons position-relative h-100 d-flex align-items-center"
class="position-absolute h-100 d-flex align-items-center translate-middle-x gap-2"
t-att-style="getUnhideButtonStyle(hiddenItem[0])">
<t t-if="!hiddenItem.includes(0)">
<div
class="o-unhide rounded"
t-att-data-index="hiddenItem_index"
t-on-click="() => this.unhide(hiddenItem)">
<t t-call="o-spreadsheet-Icon.TRIANGLE_LEFT"/>
</div>
</t>
<t
t-if="!hiddenItem.includes(env.model.getters.getNumberCols(env.model.getters.getActiveSheetId())-1)">
<div
class="o-unhide rounded"
t-att-data-index="hiddenItem_index"
t-on-click="() => this.unhide(hiddenItem)">
<t t-call="o-spreadsheet-Icon.TRIANGLE_RIGHT"/>
</div>
</t>
<div
class="o-unhide rounded"
t-att-class="{'invisible': hiddenItem.includes(0)}"
t-att-data-index="hiddenItem_index"
t-on-click="() => this.unhide(hiddenItem)">
<t t-call="o-spreadsheet-Icon.TRIANGLE_LEFT"/>
</div>
<div
class="o-unhide rounded"
t-att-class="{'invisible': hiddenItem.includes(env.model.getters.getNumberCols(env.model.getters.getActiveSheetId())-1)}"
t-att-data-index="hiddenItem_index"
t-on-click="() => this.unhide(hiddenItem)">
<t t-call="o-spreadsheet-Icon.TRIANGLE_RIGHT"/>
</div>
</div>
</t>
</div>
Expand Down