codeant-ai-for-open-source[bot] commented on code in PR #40169: URL: https://github.com/apache/superset/pull/40169#discussion_r3248235801
########## superset-frontend/src/components/ListView/Filters/FilterPopoverContent.tsx: ########## @@ -0,0 +1,65 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import type { ReactNode } from 'react'; +import { t } from '@apache-superset/core/translation'; +import { styled, css } from '@apache-superset/core/theme'; +import { Button } from '@superset-ui/core/components'; + +interface FilterPopoverContentProps { + children: ReactNode; + /** Injected by CompactFilterTrigger via cloneElement */ + onClose?: () => void; + /** Injected by CompactFilterTrigger via cloneElement — unused but accepted to avoid React unknown-prop warnings */ + isOpen?: boolean; +} + +const Wrapper = styled.div` + ${({ theme }) => css` + padding: ${theme.sizeUnit * 2}px; + display: flex; + flex-direction: column; + gap: ${theme.sizeUnit * 2}px; + + /* Hide the redundant label inside the popover — the pill already shows it */ + label { + display: none; Review Comment: **Suggestion:** Hiding all nested `label` elements with `display: none` removes label text from the accessibility tree, which leaves form controls inside the popover without proper accessible naming. Scope this styling to only the specific visual label you want hidden and use a visually-hidden pattern when needed instead of removing labels entirely. [code quality] <details> <summary><b>Severity Level:</b> Major ⚠️</summary> ```mdx - ⚠️ Date range popover inputs lose visible and programmatic labels. - ⚠️ Numerical range inputs harder to use with screen readers. - ⚠️ Filter UX degraded on `/dashboard/list` and similar routes. ``` </details> <details> <summary><b>Steps of Reproduction ✅ </b></summary> ```mdx 1. `DateRangeFilter` in `superset-frontend/src/components/ListView/Filters/DateRange.tsx:77-86` renders a `FilterContainer` (`Base.ts`) with `<FormLabel>{Header}</FormLabel>` above an AntD `RangePicker`, so the control's descriptive text comes from this label. 2. `NumericalRangeFilter` in `superset-frontend/src/components/ListView/Filters/NumericalRange.tsx:100-124` similarly renders `FilterContainer` with `<FormLabel>{Header}</FormLabel>` above two `InputNumber` fields for the min and max values, again relying on the label for context. 3. In `superset-frontend/src/components/ListView/Filters/index.tsx:79-105` and `129-139`, `UIFilters` renders both `DateRangeFilter` and `NumericalRangeFilter` inside `<FilterPopoverContent>` as the body of `CompactFilterTrigger` pills for `datetime_range` and `numerical_range` filters. 4. `FilterPopoverContent` defines `Wrapper` at `superset-frontend/src/components/ListView/Filters/FilterPopoverContent.tsx:32-42` with a nested CSS rule `label { display: none; }`, which applies to all `<label>` descendants inside the popover, including the `FormLabel` elements rendered by the filters in steps 1–2; this hides the labels visually and removes them from the accessibility tree. 5. `ListViewUIFilters` is exported from `superset-frontend/src/components/ListView/index.ts:20-26` and used by generic CRUD list pages such as `/dashboard/list` defined in `superset-frontend/src/views/routes.tsx:226-228`, so when a user opens a date or numerical range pill on these list views, the associated `<label>` text is suppressed, leaving those controls without proper accessible naming. This is not intentional elsewhere (e.g. `FilterContainer` in `Base.ts` styles `label` for visibility), so the blanket `display: none` is a real accessibility regression. ``` </details> [Fix in Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20superset-frontend%2Fsrc%2Fcomponents%2FListView%2FFilters%2FFilterPopoverContent.tsx%0A%2A%2ALine%3A%2A%2A%2040%3A41%0A%2A%2AComment%3A%2A%2A%0A%09%2ACode%20Quality%3A%20Hiding%20all%20nested%20%60label%60%20elements%20with%20%60display%3A%20none%60%20removes%20label%20text%20from%20the%20accessibility%20tree%2C%20which%20leaves%20form%20controls%20inside%20the%20popover%20without%20proper%20accessible%20naming.%20Scope%20this%20styling%20to%20only%20the%20specific%20visual%20label%20you%20want%20hidden%20and%20use%20a%20visually-hidden%20pattern%20when%20needed%20instead%20of%20removing%20labels%20entirely.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20 is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20minimal%20fix%0A) | [Fix in VSCode Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20superset-frontend%2Fsrc%2Fcomponents%2FListView%2FFilters%2FFilterPopoverContent.tsx%0A%2A%2ALine%3A%2A%2A%2040%3A41%0A%2A%2AComment%3A%2A%2A%0A%09%2ACode%20Quality%3A%20Hiding%20all%20nested%20%60label%60%20elements%20with%20%60display%3A%20none%60%20removes%20label%20text%20from%20the%20accessibility%20tree%2C%20which%20leaves%20form%20controls%20inside%20the%20popover%20without%20proper%20accessible%20naming.%20Scope%20this%20styling%20to%20only%20the%20specific%20visual%20label%20you%20want%20hidden %20and%20use%20a%20visually-hidden%20pattern%20when%20needed%20instead%20of%20removing%20labels%20entirely.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20minimal%20fix%0A) *(Use Cmd/Ctrl + Click for best experience)* <details> <summary><b>Prompt for AI Agent 🤖 </b></summary> ```mdx This is a comment left during a code review. **Path:** superset-frontend/src/components/ListView/Filters/FilterPopoverContent.tsx **Line:** 40:41 **Comment:** *Code Quality: Hiding all nested `label` elements with `display: none` removes label text from the accessibility tree, which leaves form controls inside the popover without proper accessible naming. Scope this styling to only the specific visual label you want hidden and use a visually-hidden pattern when needed instead of removing labels entirely. Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise. Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix ``` </details> <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40169&comment_hash=2dd63083665e42c01d10907a7f5440c44fcf3df45700a9964e90a02222c532d0&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40169&comment_hash=2dd63083665e42c01d10907a7f5440c44fcf3df45700a9964e90a02222c532d0&reaction=dislike'>👎</a> -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
