Skip to content

Commit

Permalink
fix: text color in interruption card and initAll function updates (#1062
Browse files Browse the repository at this point in the history
)

* fix(interruption card): fix body text color when govuk-global-styles is true (#1059)

If the component is used when govuk global styles is set to true, the i
specificity isn't high enough to override the text color to white.
This commit adds extra css to ensure elements within the interruption
card body are given the correct text size and color.

* fix(inital): remove duplicate initialisation block in all.js (#1060)

The code block to initialize sortable table copmonents was duplicated

* fix(initall): ensure datepickers respect scope when initialised (#1061)

Datepickers were always initialised within the document scope, and would ignore any scope passed to
the intiAll function.
  • Loading branch information
chrispymm authored Jan 9, 2025
1 parent 2ab2996 commit c8a3800
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 1 addition & 8 deletions src/moj/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,7 @@ MOJFrontend.initAll = function (options) {
});
});

var $sortableTables = scope.querySelectorAll('[data-module="moj-sortable-table"]');
MOJFrontend.nodeListForEach($sortableTables, function ($table) {
new MOJFrontend.SortableTable({
table: $table
});
});

const $datepickers = document.querySelectorAll('[data-module="moj-date-picker"]')
const $datepickers = scope.querySelectorAll('[data-module="moj-date-picker"]')
MOJFrontend.nodeListForEach($datepickers, function ($datepicker) {
new MOJFrontend.DatePicker($datepicker, {}).init();
})
Expand Down
7 changes: 7 additions & 0 deletions src/moj/components/interruption-card/_interruption-card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
color: govuk-colour("white");
}

// If $govuk-global-styles is true, we need to override the color and size on elements
// within the body class directly
.moj-interruption-card__body > * {
@include govuk-font-size($size: 24);
color: govuk-colour("white");
}

.moj-interruption-card__body:last-child {
margin-bottom: 0;
}
Expand Down

0 comments on commit c8a3800

Please sign in to comment.