Skip to content

Commit

Permalink
[7.17] [Dashboard] Fix z-index of embPanel__header--floater (#136463
Browse files Browse the repository at this point in the history
) (#152390)

# Backport

This will backport the following commits from `main` to `7.17`:
- [[Dashboard] Fix `z-index` of `embPanel__header--floater`
(#136463)](#136463)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Hannah
Mudge","email":"[email protected]"},"sourceCommit":{"committedDate":"2022-07-19T16:15:31Z","message":"[Dashboard]
Fix `z-index` of `embPanel__header--floater` (#136463)\n\n* Remove panel
wrapper element\r\n\r\n* Fix functional tests to work without
wrapper\r\n\r\n* Remove duplicated code\r\n\r\n* Re-add classes to
right-justify in view mode\r\n\r\n* Apply high z-index to children of
floating header rather than
parent","sha":"b31b076b0789545a4dbeb85b1a6d90283c9e6cfb","branchLabelMapping":{"^v8.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Dashboard","Feature:Embedding","release_note:fix","Team:Presentation","loe:hours","impact:medium","auto-backport","v8.4.0","v8.3.3"],"number":136463,"url":"https://github.com/elastic/kibana/pull/136463","mergeCommit":{"message":"[Dashboard]
Fix `z-index` of `embPanel__header--floater` (#136463)\n\n* Remove panel
wrapper element\r\n\r\n* Fix functional tests to work without
wrapper\r\n\r\n* Remove duplicated code\r\n\r\n* Re-add classes to
right-justify in view mode\r\n\r\n* Apply high z-index to children of
floating header rather than
parent","sha":"b31b076b0789545a4dbeb85b1a6d90283c9e6cfb"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.4.0","labelRegex":"^v8.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/136463","number":136463,"mergeCommit":{"message":"[Dashboard]
Fix `z-index` of `embPanel__header--floater` (#136463)\n\n* Remove panel
wrapper element\r\n\r\n* Fix functional tests to work without
wrapper\r\n\r\n* Remove duplicated code\r\n\r\n* Re-add classes to
right-justify in view mode\r\n\r\n* Apply high z-index to children of
floating header rather than
parent","sha":"b31b076b0789545a4dbeb85b1a6d90283c9e6cfb"}},{"branch":"8.3","label":"v8.3.3","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/136661","number":136661,"state":"MERGED","mergeCommit":{"sha":"561d89b449b5608181b058357c3c215f58223f91","message":"[Dashboard]
Fix `z-index` of `embPanel__header--floater` (#136463) (#136661)\n\n*
Remove panel wrapper element\n\n* Fix functional tests to work without
wrapper\n\n* Remove duplicated code\n\n* Re-add classes to right-justify
in view mode\n\n* Apply high z-index to children of floating header
rather than parent\n\n(cherry picked from commit
b31b076)\n\n#
Conflicts:\n#\ttest/functional/apps/dashboard_elements/controls/controls_callout.ts"}}]}]
BACKPORT-->
  • Loading branch information
Heenawter authored Feb 28, 2023
1 parent 4e6fb42 commit bab843f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@
right: 0;
top: 0;
left: 0;
z-index: $euiZLevel1;
* {
z-index: $euiZLevel1; // apply high z-index to all children
}
}

// OPTIONS MENU
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export function PanelHeader({

if (!showPanelBar) {
return (
<div data-test-subj="dashboardPanelTitle__wrapper" className={classes}>
<div className={classes}>
<PanelOptionsMenu
getActionContextMenuPanel={getActionContextMenuPanel}
isViewMode={isViewMode}
Expand Down Expand Up @@ -212,24 +212,22 @@ export function PanelHeader({
};

return (
<span data-test-subj="dashboardPanelTitle__wrapper">
<figcaption
className={classes}
data-test-subj={`embeddablePanelHeading-${(title || '').replace(/\s/g, '')}`}
>
<h2 data-test-subj="dashboardPanelTitle" className="embPanel__title embPanel__dragger">
<EuiScreenReaderOnly>{getAriaLabel()}</EuiScreenReaderOnly>
{renderTitle()}
{renderBadges(badges, embeddable)}
</h2>
{renderNotifications(notifications, embeddable)}
<PanelOptionsMenu
isViewMode={isViewMode}
getActionContextMenuPanel={getActionContextMenuPanel}
closeContextMenu={closeContextMenu}
title={title}
/>
</figcaption>
</span>
<figcaption
className={classes}
data-test-subj={`embeddablePanelHeading-${(title || '').replace(/\s/g, '')}`}
>
<h2 data-test-subj="dashboardPanelTitle" className="embPanel__title embPanel__dragger">
<EuiScreenReaderOnly>{getAriaLabel()}</EuiScreenReaderOnly>
{renderTitle()}
{renderBadges(badges, embeddable)}
</h2>
{renderNotifications(notifications, embeddable)}
<PanelOptionsMenu
isViewMode={isViewMode}
getActionContextMenuPanel={getActionContextMenuPanel}
closeContextMenu={closeContextMenu}
title={title}
/>
</figcaption>
);
}
13 changes: 9 additions & 4 deletions test/functional/page_objects/dashboard_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,9 @@ export class DashboardPageObject extends FtrService {
return await Promise.all(titleObjects.map(async (title) => await title.getVisibleText()));
}

// returns an array of Boolean values - true if the panel title is visible in view mode, false if it is not
/**
* @return An array of boolean values - true if the panel title is visible in view mode, false if it is not
*/
public async getVisibilityOfPanelTitles() {
this.log.debug('in getVisibilityOfPanels');
// only works if the dashboard is in view mode
Expand All @@ -534,9 +536,12 @@ export class DashboardPageObject extends FtrService {
await this.clickCancelOutOfEditMode();
}
const visibilities: boolean[] = [];
const titleObjects = await this.testSubjects.findAll('dashboardPanelTitle__wrapper');
for (const titleObject of titleObjects) {
const exists = !(await titleObject.elementHasClass('embPanel__header--floater'));
const panels = await this.getDashboardPanels();
for (const panel of panels) {
const exists = await this.find.descendantExistsByCssSelector(
'figcaption.embPanel__header',
panel
);
visibilities.push(exists);
}
// return to edit mode if a switch to view mode above was necessary
Expand Down
4 changes: 2 additions & 2 deletions x-pack/test/functional/apps/dashboard/panel_titles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.dashboard.saveDashboard(DASHBOARD_NAME);
});

describe('panel titles - by value', () => {
describe('by value', () => {
const clearUnsavedChanges = async () => {
await retry.try(async () => {
// avoid flaky test by surrounding in retry
Expand Down Expand Up @@ -110,7 +110,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});

describe('panel titles - by reference', () => {
describe('by reference', () => {
it('linking a by value panel with a custom title to the library will overwrite the custom title with the library title', async () => {
await dashboardPanelActions.setCustomPanelTitle(CUSTOM_TITLE);
await dashboardPanelActions.saveToLibrary(LIBRARY_TITLE_FOR_CUSTOM_TESTS);
Expand Down

0 comments on commit bab843f

Please sign in to comment.