Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/main/cypress/specs/Table.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,18 @@ describe("Table - Fixed Header", () => {

check(50, "#row-100");
});

it("creates a stacking context on the table host", () => {
cy.mount(
<Table id="table" accessibleNameRef="title" noDataText="No data found">
<TableHeaderRow slot="headerRow">
<TableHeaderCell><span>ColumnA</span></TableHeaderCell>
</TableHeaderRow>
</Table>,
);

cy.get("#table").should("have.css", "z-index", "0");
});
});

describe("Table - Horizontal Scrolling", () => {
Expand Down
22 changes: 12 additions & 10 deletions packages/main/cypress/specs/TableCustomAnnouncement.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const {
TABLE_SELECTION: { defaultText: SELECTION },
TABLE_COLUMN_HEADER_ROW: { defaultText: COLUMN_HEADER_ROW },
TABLE_ROW_SELECTED: { defaultText: SELECTED },
TABLE_ROW_NAVIGABLE: { defaultText: NAVIGABLE },
TABLE_ROW_NAVIGATED: { defaultText: NAVIGATED },
TABLE_ROW_ACTIVE: { defaultText: ACTIVE },
} = Translations;
Expand All @@ -59,7 +58,7 @@ describe("Cell Custom Announcement - More details", () => {
<TableCell><input id="row1-input1" value="Row1Input1"/><input id="row1-input2" value="Row1Input2" hidden/></TableCell>
<TableCell><div id="row1-div"><b></b></div></TableCell>
<TableCell><Button id="row1-button">Row1Cell3</Button></TableCell>
<TableRowActionNavigation slot="actions" id="row1-nav-action"></TableRowActionNavigation>
<TableRowActionNavigation slot="actions" id="row1-nav-action" interactive={true}></TableRowActionNavigation>
<TableRowAction slot="actions" id="row1-add-action" icon={add} text="Add"></TableRowAction>
<TableRowAction slot="actions" id="row1-edit-action" icon={edit} text="Edit"></TableRowAction>
</TableRow>
Expand Down Expand Up @@ -146,22 +145,25 @@ describe("Cell Custom Announcement - More details", () => {
checkAnnouncement(`Button with custom accessibility text . ${CONTAINS_CONTROL}`, true);

cy.realPress("ArrowRight"); // Row actions cell
checkAnnouncement(Table.i18nBundle.getText(MULTIPLE_ACTIONS, 2));
checkAnnouncement(Table.i18nBundle.getText(MULTIPLE_ACTIONS, 3));
cy.focused().should("have.attr", "aria-colindex", "6")
.should("have.attr", "role", "gridcell")
.then($rowActionsCell => {
const rowActionsCell = $rowActionsCell[0];
const invisibleText = document.getElementById("ui5-invisible-text");
expect(rowActionsCell.ariaLabelledByElements[0]).to.equal(invisibleText);
expect(rowActionsCell.ariaLabelledByElements![0]).to.equal(invisibleText);
rowActionsCell.blur();
expect(rowActionsCell.ariaLabelledByElements).to.equal(null);
rowActionsCell.focus();
});

cy.get("#row1-edit-action").invoke("remove");
checkAnnouncement(ONE_ROW_ACTION, true);
checkAnnouncement(Table.i18nBundle.getText(MULTIPLE_ACTIONS, 2), true);

cy.get("#row1-add-action").invoke("remove");
checkAnnouncement(ONE_ROW_ACTION, true);

cy.get("#row1-nav-action").invoke("remove");
checkAnnouncement(EMPTY, true);

cy.get("@row1NavigatedCell").should("have.attr", "role", "none")
Expand Down Expand Up @@ -251,7 +253,7 @@ describe("Row Custom Announcement - Less details", () => {
C4
<Button id="row1-button">C4Button</Button>
</TableCell>
<TableRowActionNavigation slot="actions" id="row1-nav-action"></TableRowActionNavigation>
<TableRowActionNavigation slot="actions" id="row1-nav-action" interactive={true}></TableRowActionNavigation>
<TableRowAction slot="actions" id="row1-add-action" icon={add} text="Add"></TableRowAction>
</TableRow>
</Table>
Expand Down Expand Up @@ -283,7 +285,7 @@ describe("Row Custom Announcement - Less details", () => {
});
});

function checkAnnouncement(expectedText: string, focusAgain = false, check = "contains") {
function checkAnnouncement(expectedText: string, focusAgain = false, check: "contains" | "equal" = "contains") {
focusAgain && cy.focused().then($el => {
if ($el.attr("ui5-table-header-row") !== undefined) {
cy.realPress("ArrowDown");
Expand All @@ -301,14 +303,14 @@ describe("Row Custom Announcement - Less details", () => {

it("should announce table rows", () => {
cy.get("@row1").realClick();
checkAnnouncement(`Row . 2 of 2 . ${SELECTED} . ${NAVIGABLE} . H1`);
checkAnnouncement(`Row . 2 of 2 . ${SELECTED} . ${ACTIVE} . H1`);
checkAnnouncement(`H1 . R1C1 . H2 . ${CONTAINS_CONTROLS} . H3 . ${EMPTY} . H4 . C4 Button C4Button`);
checkAnnouncement(ONE_ROW_ACTION);
checkAnnouncement(Table.i18nBundle.getText(MULTIPLE_ACTIONS, 2));
cy.focused().should("have.attr", "aria-rowindex", "2")
.should("have.attr", "role", "row");

cy.get("#selection").invoke("attr", "selected", "");
checkAnnouncement(`Row . 2 of 2 . ${NAVIGABLE}`, true);
checkAnnouncement(`Row . 2 of 2 . ${ACTIVE}`, true);

cy.get("#row1-nav-action").invoke("prop", "interactive", true);
checkAnnouncement(`Row . 2 of 2 . ${ACTIVE} . H1`, true);
Expand Down
6 changes: 3 additions & 3 deletions packages/main/cypress/specs/TableRowActions.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe("TableRowActions", () => {
<TableRowAction slot="actions" icon={add} text="Add" invisible={true}></TableRowAction>
</TableRow>
<TableRow>
<TableRowActionNavigation slot="actions"></TableRowActionNavigation>
<TableRowActionNavigation slot="actions" interactive={true}></TableRowActionNavigation>
</TableRow>
<TableRow id="navigationRow">
<TableRowActionNavigation slot="actions" id="navigationAction" interactive={true}></TableRowActionNavigation>
Expand All @@ -71,7 +71,7 @@ describe("TableRowActions", () => {
checkTemplateColumn(`${8 + 36 + 8}px`);
cy.get("@row1").find("[icon=add]").shadow().find("ui5-button").should("exist");
cy.get("@row2").find("[icon=add]").should("have.css", "display", "block");
cy.get("@row3").find("ui5-table-row-action-navigation").shadow().find("ui5-icon").should("have.attr", "name", "navigation-right-arrow");
cy.get("@row3").find("ui5-table-row-action-navigation").shadow().find("ui5-button").should("have.attr", "icon", "navigation-right-arrow");
cy.get("@row4").find("ui5-table-row-action-navigation").shadow().find("ui5-button").should("have.attr", "icon", "navigation-right-arrow");

cy.get("#addAction").invoke("on", "click", cy.stub().as("addActionClick"));
Expand Down Expand Up @@ -213,7 +213,7 @@ describe("TableRowActions", () => {
it("tests that the aligment of navigation is more important than avoiding overflow", () => {
mountTable(3, () => <>
<TableRow>
<TableRowActionNavigation slot="actions" invisible={true}></TableRowActionNavigation>
<TableRowActionNavigation slot="actions" invisible={true} interactive={true}></TableRowActionNavigation>
<TableRowAction slot="actions" icon={add} text="Add"></TableRowAction>
<TableRowAction slot="actions" icon={edit} text="Edit"></TableRowAction>
<TableRowAction slot="actions" icon={deleteIcon} text="Delete"></TableRowAction>
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/TableRowActionBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ abstract class TableRowActionBase extends UI5Element {
}

get _isInteractive() {
return this.getRenderInfo().interactive;
return this.getRenderInfo().interactive !== false;
}
}

Expand Down
15 changes: 14 additions & 1 deletion packages/main/src/TableRowActionNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class TableRowActionNavigation extends TableRowActionBase {
* @deprecated As of version 2.20.0, the navigation icon is deprecated.
* For better accessibility, the interactive mode which renders a button, must be used instead. To handle the action, attach a listener to the `click` event.
* If the navigation should be triggered when a row is pressed, set the row's `interactive` property and use the `row-click` event of the `ui5-table`.
* This property will be removed in a future release.
* This property will be removed in the next major version.
*/
@property({ type: Boolean })
interactive = false;
Expand All @@ -43,6 +43,19 @@ class TableRowActionNavigation extends TableRowActionBase {
return true;
}

onEnterDOM(): void {
super.onEnterDOM();
if (!this.interactive) {
// eslint-disable-next-line no-console
console.warn(
"[ui5-table-row-action-navigation] The non-interactive (icon) rendering mode is deprecated and will be removed in the next major version. "
+ "Set the `interactive` property to render the navigation action as an accessible button and handle the action via the `click` event. "
+ "If the navigation should be triggered when a row is pressed, set the row's `interactive` property and use the `row-click` event of `ui5-table`. "
+ "Button rendering will become the only supported behavior, and the `interactive` property will then be removed.",
);
}
}

getRenderInfo() {
return {
text: this._i18nNavigation,
Expand Down
5 changes: 1 addition & 4 deletions packages/main/src/themes/Table.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
:host {
display: block;
position: relative;
z-index: 0; /* create a stacking context for the sticky elements */
color: var(--sapList_TextColor);
font: var(--sapFontSize) var(--sapFontFamily);
}
Expand Down Expand Up @@ -36,8 +37,4 @@
inset: 0;
height: 100%;
z-index: 2;
}

:host([loading]) #table:has(#loading[_is-busy]) ::slotted(*) {
opacity: var(--sapContent_DisabledOpacity);
}
2 changes: 1 addition & 1 deletion packages/website/docs/_samples/main/Table/Basic/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "@ui5/webcomponents/dist/Table.js";
import "@ui5/webcomponents/dist/TableHeaderRow.js";
import "@ui5/webcomponents/dist/TableHeaderCell.js";
import "@ui5/webcomponents/dist/Label.js";
import "@ui5/webcomponents/dist/Text.js";
30 changes: 15 additions & 15 deletions packages/website/docs/_samples/main/Table/Basic/sample.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@
<ui5-table-header-cell id="priceCol" width="220px">Price</ui5-table-header-cell>
</ui5-table-header-row>
<ui5-table-row>
<ui5-table-cell><ui5-label><b>Notebook Basic 15</b><br>HT-1000</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label>Very Best Screens</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label>30 x 18 x 3 cm</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label style="color: #2b7c2b"><b>4.2</b> KG</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label><b>956</b> EUR</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-text><b>Notebook Basic 15</b><br>HT-1000</ui5-text></ui5-table-cell>
<ui5-table-cell><ui5-text>Very Best Screens</ui5-text></ui5-table-cell>
<ui5-table-cell><ui5-text>30 x 18 x 3 cm</ui5-text></ui5-table-cell>
<ui5-table-cell><ui5-text style="color: #2b7c2b"><b>4.2</b> KG</ui5-text></ui5-table-cell>
<ui5-table-cell><ui5-text><b>956</b> EUR</ui5-text></ui5-table-cell>
</ui5-table-row>
<ui5-table-row>
<ui5-table-cell><ui5-label><b>Notebook Basic 17</b><br>HT-1001</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label>Smartcards</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label>29 x 17 x 3.1 cm</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label style="color: #2b7c2b"><b>4.5</b> KG</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label><b>1249</b> EUR</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-text><b>Notebook Basic 17</b><br>HT-1001</ui5-text></ui5-table-cell>
<ui5-table-cell><ui5-text>Smartcards</ui5-text></ui5-table-cell>
<ui5-table-cell><ui5-text>29 x 17 x 3.1 cm</ui5-text></ui5-table-cell>
<ui5-table-cell><ui5-text style="color: #2b7c2b"><b>4.5</b> KG</ui5-text></ui5-table-cell>
<ui5-table-cell><ui5-text><b>1249</b> EUR</ui5-text></ui5-table-cell>
</ui5-table-row>
<ui5-table-row>
<ui5-table-cell><ui5-label><b>Notebook Basic 18</b><br>HT-1002</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label>Technocom</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label>32 x 21 x 4 cm</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label style="color: #2b7c2b"><b>3.7</b> KG</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label><b>29</b> EUR</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-text><b>Notebook Basic 18</b><br>HT-1002</ui5-text></ui5-table-cell>
Comment thread
simlin marked this conversation as resolved.
<ui5-table-cell><ui5-text>Technocom</ui5-text></ui5-table-cell>
<ui5-table-cell><ui5-text>32 x 21 x 4 cm</ui5-text></ui5-table-cell>
<ui5-table-cell><ui5-text style="color: #2b7c2b"><b>3.7</b> KG</ui5-text></ui5-table-cell>
<ui5-table-cell><ui5-text><b>29</b> EUR</ui5-text></ui5-table-cell>
</ui5-table-row>
</ui5-table>
<!-- playground-fold -->
Expand Down
52 changes: 26 additions & 26 deletions packages/website/docs/_samples/main/Table/Basic/sample.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import createReactComponent from "@ui5/webcomponents-base/dist/createReactComponent.js";
import LabelClass from "@ui5/webcomponents/dist/Label.js";
import TableClass from "@ui5/webcomponents/dist/Table.js";
import TableCellClass from "@ui5/webcomponents/dist/TableCell.js";
import TableHeaderCellClass from "@ui5/webcomponents/dist/TableHeaderCell.js";
import TableHeaderRowClass from "@ui5/webcomponents/dist/TableHeaderRow.js";
import TableRowClass from "@ui5/webcomponents/dist/TableRow.js";
import TextClass from "@ui5/webcomponents/dist/Text.js";

const Label = createReactComponent(LabelClass);
const Table = createReactComponent(TableClass);
const TableCell = createReactComponent(TableCellClass);
const TableHeaderCell = createReactComponent(TableHeaderCellClass);
const TableHeaderRow = createReactComponent(TableHeaderRowClass);
const TableRow = createReactComponent(TableRowClass);
const Text = createReactComponent(TextClass);

function App() {
return (
Expand All @@ -36,77 +36,77 @@ function App() {
</TableHeaderRow>
<TableRow>
<TableCell>
<Label>
<Text>
<b>Notebook Basic 15</b>
<br />
HT-1000
</Label>
</Text>
</TableCell>
<TableCell>
<Label>Very Best Screens</Label>
<Text>Very Best Screens</Text>
</TableCell>
<TableCell>
<Label>30 x 18 x 3 cm</Label>
<Text>30 x 18 x 3 cm</Text>
</TableCell>
<TableCell>
<Label style={{ color: "#2b7c2b" }}>
<Text style={{ color: "#2b7c2b" }}>
<b>4.2</b> KG
</Label>
</Text>
</TableCell>
<TableCell>
<Label>
<Text>
<b>956</b> EUR
</Label>
</Text>
</TableCell>
</TableRow>
<TableRow>
<TableCell>
<Label>
<Text>
<b>Notebook Basic 17</b>
<br />
HT-1001
</Label>
</Text>
</TableCell>
<TableCell>
<Label>Smartcards</Label>
<Text>Smartcards</Text>
</TableCell>
<TableCell>
<Label>29 x 17 x 3.1 cm</Label>
<Text>29 x 17 x 3.1 cm</Text>
</TableCell>
<TableCell>
<Label style={{ color: "#2b7c2b" }}>
<Text style={{ color: "#2b7c2b" }}>
<b>4.5</b> KG
</Label>
</Text>
</TableCell>
<TableCell>
<Label>
<Text>
<b>1249</b> EUR
</Label>
</Text>
</TableCell>
</TableRow>
<TableRow>
<TableCell>
<Label>
<Text>
<b>Notebook Basic 18</b>
<br />
HT-1002
</Label>
</Text>
</TableCell>
<TableCell>
<Label>Technocom</Label>
<Text>Technocom</Text>
</TableCell>
<TableCell>
<Label>32 x 21 x 4 cm</Label>
<Text>32 x 21 x 4 cm</Text>
</TableCell>
<TableCell>
<Label style={{ color: "#2b7c2b" }}>
<Text style={{ color: "#2b7c2b" }}>
<b>3.7</b> KG
</Label>
</Text>
</TableCell>
<TableCell>
<Label>
<Text>
<b>29</b> EUR
</Label>
</Text>
</TableCell>
</TableRow>
</Table>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import "@ui5/webcomponents/dist/Table.js";
import "@ui5/webcomponents/dist/TableHeaderRow.js";
import "@ui5/webcomponents/dist/TableHeaderCell.js";
import "@ui5/webcomponents/dist/Label.js";
import "@ui5/webcomponents/dist/Slider.js";
import "@ui5/webcomponents/dist/Text.js";

const slider = document.getElementById("slider");
const table = document.getElementById("table");
Expand Down
24 changes: 12 additions & 12 deletions packages/website/docs/_samples/main/Table/ColumnWidths/sample.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@
</ui5-table-header-row>
<!-- playground-fold -->
<ui5-table-row>
<ui5-table-cell><ui5-label><b>Notebook Basic 15</b><br>HT-1000</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label>Very Best Screens</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label>30 x 18 x 3 cm</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label style="color: #2b7c2b"><b>4.2</b> KG</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-text><b>Notebook Basic 15</b><br>HT-1000</ui5-text></ui5-table-cell>
<ui5-table-cell><ui5-text>Very Best Screens</ui5-text></ui5-table-cell>
<ui5-table-cell><ui5-text>30 x 18 x 3 cm</ui5-text></ui5-table-cell>
<ui5-table-cell><ui5-text style="color: #2b7c2b"><b>4.2</b> KG</ui5-text></ui5-table-cell>
</ui5-table-row>
<ui5-table-row>
<ui5-table-cell><ui5-label><b>Notebook Basic 17</b><br>HT-1001</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label>Smartcards</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label>29 x 17 x 3.1 cm</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label style="color: #2b7c2b"><b>4.5</b> KG</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-text><b>Notebook Basic 17</b><br>HT-1001</ui5-text></ui5-table-cell>
<ui5-table-cell><ui5-text>Smartcards</ui5-text></ui5-table-cell>
<ui5-table-cell><ui5-text>29 x 17 x 3.1 cm</ui5-text></ui5-table-cell>
<ui5-table-cell><ui5-text style="color: #2b7c2b"><b>4.5</b> KG</ui5-text></ui5-table-cell>
</ui5-table-row>
<ui5-table-row>
<ui5-table-cell><ui5-label><b>Notebook Basic 18</b><br>HT-1002</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label>Technocom</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label>32 x 21 x 4 cm</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-label style="color: #2b7c2b"><b>3.1</b> KG</ui5-label></ui5-table-cell>
<ui5-table-cell><ui5-text><b>Notebook Basic 18</b><br>HT-1002</ui5-text></ui5-table-cell>
<ui5-table-cell><ui5-text>Technocom</ui5-text></ui5-table-cell>
<ui5-table-cell><ui5-text>32 x 21 x 4 cm</ui5-text></ui5-table-cell>
<ui5-table-cell><ui5-text style="color: #2b7c2b"><b>3.1</b> KG</ui5-text></ui5-table-cell>
</ui5-table-row>
<!-- playground-fold-end -->
</ui5-table>
Expand Down
Loading
Loading