豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit 71a950f

Browse files
fix(chart table in dashboard): improve screen reading of table (#26453)
Co-authored-by: Elizabeth Thompson <eschutho@gmail.com>
1 parent be7c949 commit 71a950f

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

superset-frontend/plugins/plugin-chart-table/src/DataTable/DataTable.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19+
1920
import React, {
2021
useCallback,
2122
useRef,

superset-frontend/plugins/plugin-chart-table/src/DataTable/hooks/useSticky.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ const fixedTableLayout: CSSProperties = { tableLayout: 'fixed' };
110110
/**
111111
* An HOC for generating sticky header and fixed-height scrollable area
112112
*/
113+
113114
function StickyWrap({
114115
sticky = {},
115116
width: maxWidth,
@@ -215,7 +216,8 @@ function StickyWrap({
215216
let sizerTable: ReactElement | undefined;
216217
let headerTable: ReactElement | undefined;
217218
let footerTable: ReactElement | undefined;
218-
let bodyTable: ReactElement | undefined;
219+
let fullTable: ReactElement | undefined;
220+
219221
if (needSizer) {
220222
const theadWithRef = React.cloneElement(thead, { ref: theadRef });
221223
const tfootWithRef = tfoot && React.cloneElement(tfoot, { ref: tfootRef });
@@ -253,6 +255,7 @@ function StickyWrap({
253255
style={{
254256
overflow: 'hidden',
255257
}}
258+
aria-hidden="true"
256259
>
257260
{React.cloneElement(
258261
table,
@@ -290,20 +293,18 @@ function StickyWrap({
290293
scrollFooterRef.current.scrollLeft = e.currentTarget.scrollLeft;
291294
}
292295
};
293-
bodyTable = (
296+
297+
fullTable = (
294298
<div
295-
key="body"
299+
key="full-table"
296300
ref={scrollBodyRef}
297-
style={{
298-
height: bodyHeight,
299-
overflow: 'auto',
300-
}}
301301
onScroll={sticky.hasHorizontalScroll ? onScroll : undefined}
302302
>
303303
{React.cloneElement(
304304
table,
305305
mergeStyleProp(table, fixedTableLayout),
306306
colgroup,
307+
thead,
307308
tbody,
308309
)}
309310
</div>
@@ -315,11 +316,11 @@ function StickyWrap({
315316
style={{
316317
width: maxWidth,
317318
height: sticky.realHeight || maxHeight,
318-
overflow: 'hidden',
319+
overflow: 'auto',
320+
padding: '0',
319321
}}
320322
>
321-
{headerTable}
322-
{bodyTable}
323+
{fullTable}
323324
{footerTable}
324325
{sizerTable}
325326
</div>

superset-frontend/plugins/plugin-chart-table/src/Styles.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ export default styled.div`
3232
td {
3333
min-width: 4.3em;
3434
}
35-
3635
thead > tr > th {
36+
position: sticky;
37+
top: -1px;
3738
padding-right: 0;
38-
position: relative;
39+
z-index: 100;
40+
border-bottom: ${theme.gridUnit / 2}px solid
41+
${theme.colors.grayscale.light2};
3942
background: ${theme.colors.grayscale.light5};
4043
text-align: left;
4144
}

0 commit comments

Comments
 (0)