()
| 776 | } |
| 777 | |
| 778 | focus() { |
| 779 | // On focusing on the textarea, read active row number to assistive tech. |
| 780 | this.setAriaOptions({ |
| 781 | setLabel: this.host.renderer.enableKeyboardAccessibility |
| 782 | }); |
| 783 | |
| 784 | if (this.tempStyle || HAS_FOCUS_ARGS || this.$focusScroll == "browser") return this.text.focus( |
| 785 | {preventScroll: true}); |
| 786 | |
| 787 | var top = this.text.style.top; |
| 788 | this.text.style.position = "fixed"; |
| 789 | this.text.style.top = "0px"; |
| 790 | try { |
| 791 | var isTransformed = this.text.getBoundingClientRect().top != 0; |
| 792 | } catch (e) { |
| 793 | // getBoundingClientRect on IE throws error if element is not in the dom tree |
| 794 | return; |
| 795 | } |
| 796 | var ancestors = []; |
| 797 | if (isTransformed) { |
| 798 | var t = this.text.parentElement; |
| 799 | while (t && t.nodeType == 1) { |
| 800 | ancestors.push(t); |
| 801 | t.setAttribute("ace_nocontext", "true"); |
| 802 | if (!t.parentElement && t.getRootNode) t = t.getRootNode()["host"]; else t = t.parentElement; |
| 803 | } |
| 804 | } |
| 805 | this.text.focus({preventScroll: true}); |
| 806 | if (isTransformed) { |
| 807 | ancestors.forEach(function (p) { |
| 808 | p.removeAttribute("ace_nocontext"); |
| 809 | }); |
| 810 | } |
| 811 | setTimeout(() => { |
| 812 | this.text.style.position = ""; |
| 813 | if (this.text.style.top == "0px") this.text.style.top = top; |
| 814 | }, 0); |
| 815 | } |
| 816 | |
| 817 | blur() { |
| 818 | this.text.blur(); |
no test coverage detected