Skip to content

Commit

Permalink
Merge pull request #87 from indirectlylit/cherry-picks
Browse files Browse the repository at this point in the history
cherry picks changes from Kolibri
  • Loading branch information
indirectlylit authored Aug 5, 2020
2 parents 704fbb0 + 0d1c9cb commit 0a76338
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 23 deletions.
24 changes: 12 additions & 12 deletions lib/KModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -291,23 +291,23 @@
this.$refs.modal.focus();
},
focusElementTest(event) {
// switching apps - not relevant
if (event.target === window) {
const { target } = event;
const noopOnFocus =
target === window || // switching apps
!this.$refs.modal || // if $refs.modal isn't available
target === this.$refs.modal || // addresses #3824
this.$refs.modal.contains(target.activeElement);
if (noopOnFocus) {
return;
}
// not sure when this would be true
if (!this.$refs.modal) {
return;
}
// addresses https://github.com/learningequality/kolibri/issues/3824
if (
event.target === this.$refs.modal ||
this.$refs.modal.contains(event.target.activeElement)
) {
// Fixes possible infinite recursion when disconnection snackbars appear
// along with KModal (#6301)
const $coreSnackbar = document.getElementById('coresnackbar');
if ($coreSnackbar && $coreSnackbar.contains(target)) {
return;
}
// focus has escaped the modal - put it back!
if (!this.$refs.modal.contains(event.target)) {
if (!this.$refs.modal.contains(target)) {
this.focusModal();
}
},
Expand Down
21 changes: 12 additions & 9 deletions lib/KRadioButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
/>

<span class="text" dir="auto">
{{ label }}
<span
<div class="truncate-text">{{ label }}</div>
<div
v-if="description"
class="description"
:style="[{ color: disabled ? '' : $themeTokens.annotation }, disabledStyle ]"
>
{{ description }}
</span>
</div>
<slot></slot>
</span>

Expand All @@ -72,7 +72,7 @@
*/
label: {
type: String,
required: true,
required: false,
},
/**
* Description for label
Expand Down Expand Up @@ -190,17 +190,20 @@
height: $radio-height;
}
.text,
.description {
display: inline-block;
}
.text {
display: inline-block;
max-width: calc(100% - #{$radio-height});
padding-left: 8px;
line-height: $radio-height;
}
.truncate-text {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.description {
width: 100%;
font-size: 12px;
line-height: normal;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/buttons-and-links/buttonMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ export default {
},
linkStyle() {
return {
color: this.$themeTokens.primary,
':hover': { color: this.$themeTokens.primaryDark },
color: this.$themeTokens.link,
':hover': { color: this.$themeTokens.linkDark },
':focus': this.$coreOutline,
':disabled': { opacity: 0.5 },
};
Expand Down
2 changes: 2 additions & 0 deletions lib/styles/colorsDefault.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export const defaultTokenMapping = {
textDisabled: 'palette.grey.v_300',
annotation: 'palette.grey.v_700',
textInverted: 'palette.white',
link: 'brand.primary.v_400',
linkDark: 'brand.primary.v_700',
loading: 'brand.secondary.v_200',
focusOutline: 'brand.secondary.v_200',
surface: 'palette.white',
Expand Down

0 comments on commit 0a76338

Please sign in to comment.