Skip to content

Commit

Permalink
Added label for the 'close' text on the modal
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-baillie-ortoo committed Dec 13, 2021
1 parent aa746de commit e86665d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,11 @@
<shortDescription>Message when CRUD violation occurs on a publish. {0} is the name of the Event.</shortDescription>
<value>Attempted to publish {0} events without the required permission</value>
</labels>
<labels>
<fullName>ortoo_core_close</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>The word 'Close', capitalised.</shortDescription>
<value>Close</value>
</labels>
</CustomLabels>
4 changes: 2 additions & 2 deletions framework/default/ortoo-core/default/lwc/modal/modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<!-- TODO: labels for 'Close' -->
<button
class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
title="Close"
title={labels.close}
onclick={handleCancel}
aria-id="cancel-cross"
>
Expand All @@ -25,7 +25,7 @@
variant="inverse"
size="small"
></lightning-icon>
<span class="slds-assistive-text">Close</span>
<span class="slds-assistive-text">{labels.close}</span>
</button>
<h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">
<slot name="title"></slot>
Expand Down
6 changes: 5 additions & 1 deletion framework/default/ortoo-core/default/lwc/modal/modal.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { LightningElement, api } from 'lwc';
import CLOSE_LABEL from '@salesforce/label/c.ortoo_core_close';

export default class Modal extends LightningElement {
@api visible;

labels = {
close: CLOSE_LABEL
};

dispatchCancel() {
const event = new CustomEvent( 'cancel' );
this.dispatchEvent( event );
Expand All @@ -12,7 +17,6 @@ export default class Modal extends LightningElement {
this.dispatchCancel();
}

// Ideally the modal would auto-focus on launch
handleKeyDown( event ) {
if( event.code == 'Escape' ) {
this.dispatchCancel();
Expand Down

0 comments on commit e86665d

Please sign in to comment.