dosubot[bot] commented on issue #29973: URL: https://github.com/apache/superset/issues/29973#issuecomment-2298140725
<!-- Answer --> To prevent the "Drill By" modal from disappearing when the source chart is out of view in an embedded Superset dashboard, you can ensure that the modal remains visible by modifying the Cypress test to handle scrolling and visibility checks. Since `maskClosable` is already set to `false`, the modal should not close when clicking outside of it. However, you need to ensure that the modal remains in view even if the source chart is scrolled out of view. Here is an example of how you can modify the Cypress test to handle this scenario: ```ts import { waitForChartLoad } from 'cypress/utils'; import { SUPPORTED_CHARTS_DASHBOARD } from 'cypress/utils/urls'; import { openTopLevelTab, SUPPORTED_TIER1_CHARTS, } from './utils'; const ensureModalInView = () => { cy.get('@drillByModal').then($modal => { if ($modal.is(':hidden')) { cy.get('@drillByModal').scrollIntoView(); } }); }; describe('Drill by modal', () => { beforeEach(() => { closeModal(); }); before(() => { cy.visit(SUPPORTED_CHARTS_DASHBOARD); }); describe('Modal actions + Table', () => { before(() => { closeModal(); openTopLevelTab('Tier 1'); SUPPORTED_TIER1_CHARTS.forEach(waitForChartLoad); }); it('opens the modal from the context menu', () => { openTableContextMenu('boy'); drillBy('state').then(intercepted => { verifyExpectedFormData(intercepted, { groupby: ['state'], adhoc_filters: [ { clause: 'WHERE', comparator: 'boy', expressionType: 'SIMPLE', operator: '==', operatorId: 'EQUALS', subject: 'gender', }, ], }); }); cy.getBySel('"Drill by: Table-modal"').as('drillByModal'); ensureModalInView(); cy.get('@drillByModal') .find('.draggable-trigger') .should('contain', 'Drill by: Table'); cy.get('@drillByModal') .find('[data-test="metadata-bar"]') .should('be.visible'); cy.get('@drillByModal') .find('.ant-breadcrumb') .should('be.visible') .and('contain', 'gender (boy)') .and('contain', '/') .and('contain', 'state'); cy.get('@drillByModal') .find('[data-test="drill-by-chart"]') .should('be.visible') .and('contain', 'state') .and('contain', 'sum__num'); // further drilling openTableContextMenu('CA', '[data-test="drill-by-chart"]'); drillBy('name').then(intercepted => { verifyExpectedFormData(intercepted, { groupby: ['name'], adhoc_filters: [ { clause: 'WHERE', comparator: 'boy', expressionType: 'SIMPLE', operator: '==', operatorId: 'EQUALS', subject: 'gender', }, { clause: 'WHERE', comparator: 'CA', expressionType: 'SIMPLE', operator: '==', operatorId: 'EQUALS', subject: 'state', }, ], }); }); ensureModalInView(); cy.get('@drillByModal') .find('[data-test="drill-by-chart"]') .should('be.visible') .and('not.contain', 'state') .and('contain', 'name') .and('contain', 'sum__num'); // undo - back to drill by state interceptV1ChartData('drillByUndo'); interceptFormDataKey(); cy.get('@drillByModal') .find('.ant-breadcrumb') .should('be.visible') .and('contain', 'gender (boy)') .and('contain', '/') .and('contain', 'state (CA)') .and('contain', 'name') .contains('state (CA)') .click(); cy.wait('@drillByUndo').then(intercepted => { verifyExpectedFormData(intercepted, { groupby: ['state'], adhoc_filters: [ { clause: 'WHERE', comparator: 'boy', expressionType: 'SIMPLE', operator: '==', operatorId: 'EQUALS', subject: 'gender', }, ], }); }); ensureModalInView(); cy.get('@drillByModal') .find('[data-test="drill-by-chart"]') .should('be.visible') .and('not.contain', 'name') .and('contain', 'state') .and('contain', 'sum__num'); cy.get('@drillByModal') .find('.ant-breadcrumb') .should('be.visible') .and('contain', 'gender (boy)') .and('contain', '/') .and('not.contain', 'state (CA)') .and('not.contain', 'name') .and('contain', 'state'); cy.get('@drillByModal') .find('[data-test="drill-by-display-toggle"]') .contains('Table') .click(); cy.getBySel('drill-by-chart').should('not.exist'); cy.get('@drillByModal') .find('[data-test="drill-by-results-table"]') .should('be.visible'); cy.wait('@formDataKey').then(intercept => { cy.get('@drillByModal') .contains('Edit chart') .should('have.attr', 'href') .and( 'contain', `/explore/?form_data_key=${intercept.response?.body?.key}`, ); }); }); }); }); ``` This code ensures that the modal is scrolled into view if it is hidden, thus preventing it from disappearing when the source chart is out of view <sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/cypress-base/cypress/e2e/dashboard/drillby.test.ts)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/cypress-base/cypress/e2e/dashboard/drilltodetail.test.ts)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org