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

Content attr as a variable, and aria-label as default for better accessibility #55

Closed
wants to merge 4 commits 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/balloon.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@balloon-bg: fade(#111, 90%);
@balloon-font-size: 12px;
@balloon-arrow-size: 6px;

@balloon-content-attr: aria-label;

//
// Mixins
Expand Down Expand Up @@ -107,7 +107,7 @@ button[data-balloon] {
background: @balloon-bg;
border-radius: @balloon-font-size / 3;
color: #fff;
content: attr(data-balloon);
content: attr(@{balloon-content-attr});
font-size: @balloon-font-size;
padding: .5em 1em;
white-space: nowrap;
Expand All @@ -118,7 +118,7 @@ button[data-balloon] {
content: "";
margin-bottom: @balloon-arrow-size - 1;
}
&:hover, &[data-balloon-visible] {
&:hover, &:focus, &[data-balloon-visible] {
&:before,
&:after {
.opacity(1);
Expand Down Expand Up @@ -154,7 +154,7 @@ button[data-balloon] {
margin-top: @balloon-arrow-size - 1;
margin-bottom: 0;
}
&:hover, &[data-balloon-visible] {
&:hover, &:focus, &[data-balloon-visible] {
&:before,
&:after {
.transform(translate(-50%, 0));
Expand All @@ -179,7 +179,7 @@ button[data-balloon] {
margin-right: @balloon-arrow-size - 1;
margin-bottom: 0;
}
&:hover, &[data-balloon-visible] {
&:hover, &:focus, &[data-balloon-visible] {
&:before,
&:after {
.transform(translate(0, -50%));
Expand All @@ -203,7 +203,7 @@ button[data-balloon] {
margin-bottom: 0;
margin-left: @balloon-arrow-size - 1;
}
&:hover, &[data-balloon-visible] {
&:hover, &:focus, &[data-balloon-visible] {
&:before,
&:after {
.transform(translate(0, -50%));
Expand Down
14 changes: 7 additions & 7 deletions src/balloon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
$balloon-bg: fade-out(#111, .1);
$balloon-base-size: 10px;
$balloon-arrow-height: 6px;

$balloon-content-attr: aria-label; // formerly data-balloon, but replaced with aria-label for better accessibility

//
// Mixins
Expand Down Expand Up @@ -90,7 +90,7 @@ button[data-balloon] {
background: $balloon-bg;
border-radius: 4px;
color: #fff;
content: attr(data-balloon);
content: attr(#{$balloon-content-attr});
font-size: $balloon-base-size + 2;
padding: .5em 1em;
position: absolute;
Expand All @@ -107,7 +107,7 @@ button[data-balloon] {
z-index: 10;
}

&:hover, &[data-balloon-visible] {
&:hover, &:focus, &[data-balloon-visible] {
&:before,
&:after {
@include opacity(1);
Expand Down Expand Up @@ -141,7 +141,7 @@ button[data-balloon] {
@include transform-origin(top);
}

&:hover, &[data-balloon-visible] {
&:hover, &:focus, &[data-balloon-visible] {
&:after {
@include transform(translate(-50%, 0));
}
Expand Down Expand Up @@ -170,7 +170,7 @@ button[data-balloon] {
@include transform(translate(-50%, -10px));
}

&:hover, &[data-balloon-visible] {
&:hover, &:focus, &[data-balloon-visible] {
&:after {
@include transform(translate(-50%, 0));
}
Expand Down Expand Up @@ -198,7 +198,7 @@ button[data-balloon] {
@include transform(translate(10px, -50%));
}

&:hover, &[data-balloon-visible] {
&:hover, &:focus, &[data-balloon-visible] {
&:after {
@include transform(translate(0, -50%));
}
Expand Down Expand Up @@ -228,7 +228,7 @@ button[data-balloon] {
@include transform(translate(-10px, -50%));
}

&:hover, &[data-balloon-visible] {
&:hover, &:focus, &[data-balloon-visible] {
&:after {
@include transform(translate(0, -50%));
}
Expand Down