Skip to content
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

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('SqlLab query tabs', () => {
});

// first item is close
cy.get('.SqlEditorTabs .ddbtn-tab .close').first().click();
cy.get('.SqlEditorTabs .ddbtn-tab .fa-close').first().click();

cy.get('.SqlEditorTabs > ul > li').should(
'have.length',
Expand Down
7 changes: 4 additions & 3 deletions superset-frontend/src/SqlLab/components/TabbedSqlEditors.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,10 @@ class TabbedSqlEditors extends React.PureComponent {
const title = (
<>
{qe.title} <TabStatusIcon tabState={state} />{' '}
<span className="close" onClick={() => this.removeQueryEditor(qe)}>
{'×'}
</span>
<i
className="fa fa-close"
Copy link
Member

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...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/apache/incubator-superset/blob/master/superset-frontend/stylesheets/less/variables.less#L48-L56

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?

Copy link
Member

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

Copy link
Author

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!

onClick={() => this.removeQueryEditor(qe)}
/>
</>
);
const tabTitle = (
Expand Down
16 changes: 8 additions & 8 deletions superset-frontend/src/SqlLab/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,14 @@ div.Workspace {
&:active {
background: none;
}

.fa.fa-close {
Copy link
Member

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 Icons that are clickable. @nytai @lilykuang or @rusackas, would any of you be interested in this? Or should I take it on?

Copy link
Author

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?

Copy link
Member

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....

Copy link
Author

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!!

Copy link
Author

@graceguo-supercat graceguo-supercat Jul 15, 2020

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

Copy link
Member

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

Copy link
Author

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...

Copy link
Member

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

color: @gray;

&:hover {
cursor: pointer;
}
}
}

.dropdown.btn-group.btn-group-sm {
Expand Down Expand Up @@ -303,14 +311,6 @@ div.Workspace {
.dropdown-toggle {
padding-top: 2px;
}

.close {
opacity: 1;
color: @almost-black;
position: relative;
top: -2px;
right: -4px;
}
}

.SqlEditor {
Expand Down