-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add additional ui tweaks #10275
fix: add additional ui tweaks #10275
Conversation
I think we're starting to move towards using it looks like this (only look at the icon in the upper right), thoughts @kenchendesign? |
there are so many places in the existed code based re-use css After that PR i will follow the new rule. |
If that's the case, then can you attach screenshots of all the other places this icon changed? I thought this was added in your PR, and not used in a bunch of other places |
Hmm, interesting. Let's see what @kenchendesign prefers, and then we can go with that design. In the future I can help clean up some of the icons and replace with SVGs if we don't do it here |
e443728
to
7a030d3
Compare
Codecov Report
@@ Coverage Diff @@
## master #10275 +/- ##
==========================================
- Coverage 70.20% 69.90% -0.31%
==========================================
Files 598 195 -403
Lines 32017 18912 -13105
Branches 3240 0 -3240
==========================================
- Hits 22477 13220 -9257
+ Misses 9435 5692 -3743
+ Partials 105 0 -105
Continue to review full report at Codecov.
|
{'×'} | ||
</span> | ||
<i | ||
className="fa fa-close" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option is to use text-muted
here.
We have grays defined somewhere I think. We should make classes for our grays that we can use anywhere...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure how to use these grays in this context, @rusackas ?
- create classes in
superset.less
and use them as classes - create a
./TabbedSqlEditors.less
and use the variable in there? - use emotion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might be even better to use emotion here. The colors should all be in styled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for suggestion. @rusackas do we have any example that i can follow to make similar thing? i am not sure which gray to use. thanks!
@etr2460 Yeah I prefer the skinny close icon. |
name="cancel-x" | ||
height="16px" | ||
width="16px" | ||
viewBox="4 4 16 16" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this required because the viewbox wasn't set correctly on the original icon? if so, maybe we should change the SVG, since it's not used anywhere else yet
height="16px" | ||
width="16px" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised the pixel strings are required here, did you test to see if numbers work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It turn out all these extra props are not necessary...i thought new icon pushed the tab taller but actually not. new svg (with 24 x 24) is good to use.
@@ -259,6 +259,22 @@ div.Workspace { | |||
&:active { | |||
background: none; | |||
} | |||
|
|||
.fa.fa-close { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the font awesome class applied anywhere, does this actually do something?
If you need to add styling to the Icon, I'd recommend making a oneoff element in the TabbedSqlEditors
file like so:
const CloseIcon = styled(Icon)`
// add css styles here
.or-add-a-class {
// more styles
}
`;
However, it looks like this styling is specifically to make the Icon interactable. In that case, to ensure a11y, you should wrap it in an a
tag, a button
tag, or some other element with the appropriate aria role applied, similar to here: 80b06f6#diff-ce4d2524d6740fe3a5ac128b5e33baa4R382
On a side note, we should create an IconButton
component that abstracts all this a11y stuff away and replaces the current uses of bare Icon
s that are clickable. @nytai @lilykuang or @rusackas, would any of you be interested in this? Or should I take it on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since when a11y is a requirement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a requirement, but certainly something we should consider i think! I can't even imagine how bad it is to use Superset with a screenreader or keyboard controls....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct. this PR can't handle big issue like that. no one will care there is an icon in whole Superset is a11y. yay!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was introduced by last try (to use font awesome icon). fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you at least add role="button" tabIndex={0}
to the Icon
component? That should be sufficient here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do change for this place. but you probably have to fix all other places...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, i'll fix other stuff in the future, likely by adding a lint rule
7880cd6
to
aba7c11
Compare
@@ -177,11 +177,9 @@ div.Workspace { | |||
|
|||
display: inline-block; | |||
background-color: @gray-light; | |||
line-height: 8px; // set specifically for closing 'x' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have to remove these 2 lines to make circle and new svg x icon aligned.
svg { | ||
vertical-align: middle; | ||
|
||
&:hover { | ||
cursor: pointer; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this, you can add the styles in JS as follows:
const CloseIcon = styled(Icon)`
vertical-align: middle;
&:hover {
cursor: pointer;
}
`;
// then inside the render function do
<CloseIcon role="button" tabIndex={0} name="cancel-x" onClick={() => this.removeQueryEditor(qe)} />
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If every time use our own svg need this much trouble, i would rather use Font-Awesome, they took care of these common behaviors (like role="button" tabIndex={0}
) already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can just add a prop to the Icon
component and extend the style there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, you don't have to do anything. Just apply cursor
directly to CloseIcon
since it's a valid attribute for SVG elements. <CloseIcon role="button" cursor="pointer">
.
You also don't have to &:hover
for cursor attributes, since it already only applies when an element is hovered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but I still need vertical-align: middle;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think it makes sense to keep that rule in main.less
for now. We'll see if it's necessary to generalize it to Icon.tsx
when we see it being needed in more places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, i will follow this suggestion :)
aba7c11
to
ff2c1aa
Compare
ff2c1aa
to
793681e
Compare
793681e
to
f9d7590
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm after you remove the unused import. thanks for the iteration to get this aligned with the newest in Superset UI architecture!
@@ -24,11 +24,13 @@ import { bindActionCreators } from 'redux'; | |||
import URI from 'urijs'; | |||
import { t } from '@superset-ui/translation'; | |||
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; | |||
import styled from '@superset-ui/style'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like you can remove this import now
f9d7590
to
21ccebd
Compare
* fix: add additional ui tweaks * use fa fa-close class for x icon * use new svg icons
SUMMARY
This PR is to finish extra UI tweaks based on the discussion on #10257 (which was merged without review approval accidentally)
x
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
After:
TEST PLAN
CI
ADDITIONAL INFORMATION
@kenchendesign @rusackas