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

input-pill: Refactor pills to eliminate fixed positioning of elements. #9941

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend_tests/node_tests/input_pill.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
set_global('$', global.make_zjquery());
set_global('i18n', global.stub_i18n);
zrequire('input_pill');

zrequire('Handlebars', 'handlebars');
Expand Down
4 changes: 4 additions & 0 deletions static/styles/compose.scss
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,10 @@ input.recipient_box {
display: flex;
}

#private-message {
align-items: center;
}

.compose_table .drafts-link {
position: relative;
margin-right: 1em;
Expand Down
31 changes: 9 additions & 22 deletions static/styles/input_pill.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.pill-container {
display: inline-block;
display: inline-flex;

padding: 2px;
border: 1px solid hsla(0, 0%, 0%, 0.15);
Expand All @@ -11,12 +11,11 @@
}

.pill-container .pill {
position: relative;
display: inline-block;
display: inline-flex;
align-items: center;

height: 20px;
padding: 0px 18px 0px 3px;
margin: 1px 1px;
margin: 1px 2px;

color: inherit;
border: 1px solid hsla(0, 0%, 0%, 0.15);
Expand Down Expand Up @@ -63,15 +62,14 @@
outline: none;
}

.pill-container .pill .exit {
content: "\D7";
position: absolute;
top: 0px;
right: 3px;
.pill-container .pill .pill-value {
margin: 0 5px;
}

.pill-container .pill .exit {
opacity: 0.5;

font-size: 1.3em;
margin-right: 3px;
}

.pill-container .pill:hover .exit {
Expand All @@ -86,14 +84,7 @@
}

.pm_recipient .pill-container {
position: relative;
width: 100%;
padding: 0px 2px;

/* this is because the pills have a margin-bottom of 2px, so we want to negate
the height of the bottom row. */
margin: -1px 0px;

border: none;

display: flex;
Expand All @@ -116,12 +107,8 @@
}

.pill-image {
position: relative;
left: -3px;
height: 20px;
width: 20px;
margin-right: 2px;
bottom: 1px;
border-radius: 4px 0 0 4px;
}

Expand Down
6 changes: 3 additions & 3 deletions static/templates/input_pill.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
{{#if has_image}}
<img class="pill-image" src={{img_src}} />
{{/if}}
{{ display_value }}
<div class='exit'>
&times;
<span class="pill-value">{{ display_value }}</span>
<div class="exit" aria-label="{{t Remove pill }}">
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

The aria-label here is invalid -- the string should be quoted. But I also don't think we really need the aria-label here; this isn't a widget you would want to interact with as a blind user (instead, you just hit backspace to get rid of it, I think?).

<span aria-hidden="true">&times;</span>
</div>
</div>