You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "anshuksi282-ksolves (via GitHub)" <gi...@apache.org> on 2025/10/07 12:34:36 UTC
[PR] Fix text selection visibility in logs and code [airflow]
anshuksi282-ksolves opened a new pull request, #56452:
URL: https://github.com/apache/airflow/pull/56452
Fix text selection contrast in Airflow UI logs and code views
Issue: #56449
Context and Problem
Following the v3.1.0 theming overhaul, Airflow adopted Chakra UI semantic tokens and a Tailwind-inspired color palette. However, explicit ::selection pseudo-element styling was omitted. As a result, browsers defaulted to low-contrast selection highlights that blend into the log and code background, making user text selections nearly invisible.
Impact
Users cannot reliably select and copy text from logs or code blocks, hindering troubleshooting, debugging, and overall accessibility.
Solution
Added global ::selection, ::-moz-selection, and ::-webkit-selection rules in the Chakra theme configuration (src/theme.ts) under globalCss, enforcing a clear blue highlight (blue.500 in light mode, blue.300 in dark mode).
Created a dedicated CSS file (src/assets/selection.css) with selection rules for pre, code, .log-viewer, and elements with data-testid*="log", ensuring consistent blue highlighting in log and code areas.
Imported selection.css in the application entry point (src/main.tsx) so that styles load early.
These changes restore high-contrast text selection, comply with WCAG AA contrast requirements, and improve user experience when copying or inspecting logs and code.
[Screencast from 2025-10-07 17-14-37.webm](https://github.com/user-attachments/assets/ff0a8254-5c4a-43ce-82b5-9622e10db6b2)
<!--
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.
-->
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
<!-- Please keep an empty line above the dashes. -->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix text selection visibility in logs and code [airflow]
Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi closed pull request #56452: Fix text selection visibility in logs and code
URL: https://github.com/apache/airflow/pull/56452
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix text selection visibility in logs and code [airflow]
Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on PR #56452:
URL: https://github.com/apache/airflow/pull/56452#issuecomment-3382608984
Oh let's not mix in css files into the Chakra React components.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix text selection visibility in logs and code [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #56452:
URL: https://github.com/apache/airflow/pull/56452#discussion_r2445310141
##########
airflow-core/src/airflow/ui/src/assets/selection.css:
##########
@@ -0,0 +1,81 @@
+/*!
+ * 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.
+ */
+
+/*
+ * Fix for text selection contrast issue #56449
+ * Text selection in logs is almost invisible (extremely low contrast in airflow 3.1.0)
+ */
+
+/* Global high-contrast text selection */
+::selection {
+ background-color: #3182ce !important;
+ color: #ffffff !important;
+ text-shadow: none !important;
+}
+
+::-moz-selection {
+ background-color: #3182ce !important;
+ color: #ffffff !important;
+ text-shadow: none !important;
+}
+
+/* Enhanced visibility for log content */
+pre ::selection,
+code ::selection,
+.log-viewer ::selection,
+[data-testid*="log"] ::selection {
Review Comment:
I don't think we should rely on `data-testid` for production code. We can set a real 'id' or use another mechanism to identify those elements.
The reason for that is because I wouldn't expect to break the code by modifying test ids. I would expect only tests to fail.
##########
airflow-core/src/airflow/ui/src/theme.ts:
##########
@@ -35,6 +35,107 @@ const generateSemanticTokens = (color: string, darkContrast: string = "white") =
export const customConfig = defineConfig({
// See https://chakra-ui.com/docs/theming/colors for more information on the colors used here.
+
+ // Fix for text selection contrast issue #56449
+
+ globalCss: {
+
+ "::selection": {
+
+ backgroundColor: "blue.500",
+
+ color: "white",
+
+ textShadow: "none",
+
+ },
+
+ "::-moz-selection": {
+
+ backgroundColor: "blue.500",
+
+ color: "white",
+
+ textShadow: "none",
+
+ },
+
+ "::-webkit-selection": {
+
+ backgroundColor: "blue.500",
Review Comment:
Is this piece necessary since we now have a separate css file ?
##########
airflow-core/src/airflow/ui/src/assets/selection.css:
##########
@@ -0,0 +1,81 @@
+/*!
+ * 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.
+ */
+
+/*
+ * Fix for text selection contrast issue #56449
+ * Text selection in logs is almost invisible (extremely low contrast in airflow 3.1.0)
+ */
+
+/* Global high-contrast text selection */
+::selection {
+ background-color: #3182ce !important;
+ color: #ffffff !important;
+ text-shadow: none !important;
+}
+
+::-moz-selection {
+ background-color: #3182ce !important;
Review Comment:
Do we need all those `!important` we tend to try to avoid them.
##########
providers/fab/src/airflow/providers/fab/www/static/css/main.css:
##########
@@ -17,6 +17,7 @@
* under the License.
*/
+
Review Comment:
```suggestion
```
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix text selection visibility in logs and code [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on PR #56452:
URL: https://github.com/apache/airflow/pull/56452#issuecomment-3422629569
I'm more in favor of https://github.com/apache/airflow/pull/56379/files. Not sure what this one brings now that it's merged.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix text selection visibility in logs and code [airflow]
Posted by "RoyLee1224 (via GitHub)" <gi...@apache.org>.
RoyLee1224 commented on PR #56452:
URL: https://github.com/apache/airflow/pull/56452#issuecomment-3390651637
I think we already have a PR for text selection here #56379
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix text selection visibility in logs and code [airflow]
Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on PR #56452:
URL: https://github.com/apache/airflow/pull/56452#issuecomment-3428539035
I agree. Let's close this one.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org