From 5be0a8962538647cb0825afc03562769d707277b Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" <70410625+michael-s-molina@users.noreply.github.com> Date: Mon, 26 Jul 2021 16:38:38 -0300 Subject: [PATCH] fix: Charts sort by in edit mode gets cut off (#15896) --- .../javascripts/dashboard/components/SliceAdder_spec.jsx | 4 ++-- superset-frontend/src/components/Select/Select.tsx | 6 ++++++ superset-frontend/src/dashboard/components/SliceAdder.jsx | 5 ++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/superset-frontend/spec/javascripts/dashboard/components/SliceAdder_spec.jsx b/superset-frontend/spec/javascripts/dashboard/components/SliceAdder_spec.jsx index 2a0cb55cad..16703d0505 100644 --- a/superset-frontend/spec/javascripts/dashboard/components/SliceAdder_spec.jsx +++ b/superset-frontend/spec/javascripts/dashboard/components/SliceAdder_spec.jsx @@ -155,10 +155,10 @@ describe('SliceAdder', () => { }); it('handleSelect', () => { - const newSortBy = { value: 'viz_type' }; + const newSortBy = 'viz_type'; wrapper.instance().handleSelect(newSortBy); expect(spy.calledOnce).toBe(true); - expect(spy.lastCall.args[1]).toBe(newSortBy.value); + expect(spy.lastCall.args[1]).toBe(newSortBy); }); it('handleKeyPress', () => { diff --git a/superset-frontend/src/components/Select/Select.tsx b/superset-frontend/src/components/Select/Select.tsx index 1ceca5313f..624571c8e5 100644 --- a/superset-frontend/src/components/Select/Select.tsx +++ b/superset-frontend/src/components/Select/Select.tsx @@ -97,6 +97,12 @@ const StyledSelect = styled(AntdSelect, { && .ant-select-selector { border-radius: ${theme.gridUnit}px; } + + // Open the dropdown when clicking on the suffix + // This is fixed in version 4.16 + .ant-select-arrow .anticon:not(.ant-select-suffix) { + pointer-events: none; + } `} `; diff --git a/superset-frontend/src/dashboard/components/SliceAdder.jsx b/superset-frontend/src/dashboard/components/SliceAdder.jsx index 12d62c5fdb..ef1e446e27 100644 --- a/superset-frontend/src/dashboard/components/SliceAdder.jsx +++ b/superset-frontend/src/dashboard/components/SliceAdder.jsx @@ -23,7 +23,7 @@ import { List } from 'react-virtualized'; import { createFilter } from 'react-search-input'; import { t, styled } from '@superset-ui/core'; import { Input } from 'src/common/components'; -import Select from 'src/components/Select'; +import { Select } from 'src/components'; import Loading from 'src/components/Loading'; import { CHART_TYPE, @@ -168,8 +168,7 @@ class SliceAdder extends React.Component { })); } - handleSelect(object) { - const sortBy = object.value; + handleSelect(sortBy) { this.setState(prevState => ({ sortBy, filteredSlices: this.getFilteredSortedSlices(