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(table): Fix selection display in RTL #7907

Merged
merged 10 commits into from
Oct 2, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ td {
color: var(--calcite-ui-brand);
}
}

.calcite--rtl.selection-cell.selected-cell {
box-shadow: inset -0.25rem 0 0 0 var(--calcite-ui-brand);
}

.selection-cell {
@apply align-middle;
& ::slotted(calcite-icon) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import { connectLocalized, disconnectLocalized, LocalizedComponent } from "../..
import { TableCellMessages } from "./assets/table-cell/t9n";
import { CSS } from "./resources";
import { RowType } from "../table/interfaces";
import { getElementDir } from "../../utils/dom";
import { CSS_UTILITY } from "../../utils/resources";

/**
* @slot - A slot for adding content, usually text content.
Expand Down Expand Up @@ -205,6 +207,8 @@ export class TableCell
//--------------------------------------------------------------------------

render(): VNode {
const dir = getElementDir(this.el);

return (
<Host>
<td
Expand All @@ -214,6 +218,7 @@ export class TableCell
[CSS.numberCell]: this.numberCell,
[CSS.selectionCell]: this.selectionCell,
[CSS.selectedCell]: this.parentRowIsSelected,
[CSS_UTILITY.rtl]: dir === "rtl",
}}
colSpan={this.colSpan}
onBlur={this.onContainerBlur}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -985,3 +985,33 @@ export const darkModeRTL_TestOnly = (): string =>
</calcite-table>`;

darkModeRTL_TestOnly.parameters = { modes: modesDarkDefault };

export const darkModeRTLWithSelection_TestOnly = (): string =>
html`<calcite-table zebra caption="Simple-zebra table" dir="rtl" selection-mode="multiple">
<calcite-table-row slot="table-header">
<calcite-table-header heading="Heading" description="Description"></calcite-table-header>
<calcite-table-header heading="Heading" description="Description"></calcite-table-header>
<calcite-table-header heading="Heading" description="Description"></calcite-table-header>
<calcite-table-header heading="Heading" description="Description"></calcite-table-header>
</calcite-table-row>
<calcite-table-row selected>
<calcite-table-cell>cell</calcite-table-cell>
<calcite-table-cell>cell</calcite-table-cell>
<calcite-table-cell>cell</calcite-table-cell>
<calcite-table-cell>cell</calcite-table-cell>
</calcite-table-row>
<calcite-table-row selected>
<calcite-table-cell>cell</calcite-table-cell>
<calcite-table-cell>cell</calcite-table-cell>
<calcite-table-cell>cell</calcite-table-cell>
<calcite-table-cell>cell</calcite-table-cell>
</calcite-table-row>
<calcite-table-row>
<calcite-table-cell>cell</calcite-table-cell>
<calcite-table-cell>cell</calcite-table-cell>
<calcite-table-cell>cell</calcite-table-cell>
<calcite-table-cell>cell</calcite-table-cell>
</calcite-table-row>
</calcite-table>`;

darkModeRTLWithSelection_TestOnly.parameters = { modes: modesDarkDefault };