From 11cdb0fffe0ce68ba66d8ccdfd40dafc67dc1054 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Wed, 16 Mar 2022 16:37:58 +0100 Subject: [PATCH 1/2] MOBILE-3833 core: Wait for visible RTE content --- .../editor/components/rich-text-editor/rich-text-editor.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/features/editor/components/rich-text-editor/rich-text-editor.ts b/src/core/features/editor/components/rich-text-editor/rich-text-editor.ts index 18a9760fb..07bf8b799 100644 --- a/src/core/features/editor/components/rich-text-editor/rich-text-editor.ts +++ b/src/core/features/editor/components/rich-text-editor/rich-text-editor.ts @@ -176,6 +176,8 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterContentIn this.editorElement.oninput = this.onChange.bind(this); this.editorElement.onkeydown = this.moveCursor.bind(this); + await CoreDomUtils.waitToBeVisible(this.editorElement); + // Use paragraph on enter. document.execCommand('DefaultParagraphSeparator', false, 'p'); From b7fe9236f6be160f18f60c5fcb9ead39b62ada7f Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Wed, 16 Mar 2022 16:39:02 +0100 Subject: [PATCH 2/2] MOBILE-3833 core: Fix button aria-label reactivity --- .../update-non-reactive-attributes.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/core/directives/update-non-reactive-attributes.ts b/src/core/directives/update-non-reactive-attributes.ts index 1c8508c3b..6089403a4 100644 --- a/src/core/directives/update-non-reactive-attributes.ts +++ b/src/core/directives/update-non-reactive-attributes.ts @@ -33,15 +33,18 @@ export class CoreUpdateNonReactiveAttributesDirective implements OnInit, OnDestr constructor(element: ElementRef) { this.element = element.nativeElement; this.mutationObserver = new MutationObserver(() => { - const ariaLabel = this.element.getAttribute('aria-label'); - if (!ariaLabel) { - // Aria label unset by ionButton component (when first created). + const button = this.element.shadowRoot?.querySelector('button'); + + if (!button) { return; } // Propagate label to button. - const button = this.element.shadowRoot?.querySelector('button'); - button?.setAttribute('aria-label', ariaLabel); + const ariaLabel = this.element.getAttribute('aria-label'); + + ariaLabel + ? button.setAttribute('aria-label', ariaLabel) + : button.removeAttribute('aria-label'); }); } @@ -51,10 +54,6 @@ export class CoreUpdateNonReactiveAttributesDirective implements OnInit, OnDestr async ngOnInit(): Promise { await this.element.componentOnReady(); - if (!this.element.getAttribute('aria-label')) { - return; - } - this.mutationObserver.observe(this.element, { attributes: true, attributeFilter: ['aria-label'] }); }