fix(textarea): inherit tabindex to inner textarea (#26945)

resolves #26944
This commit is contained in:
Liam DeBeasi
2023-03-13 10:12:37 -04:00
committed by GitHub
parent 389595de3b
commit 2c68d01b89
3 changed files with 29 additions and 1 deletions

View File

@ -0,0 +1,14 @@
import { newSpecPage } from '@stencil/core/testing';
import { Input } from '../input';
it('should inherit attributes', async () => {
const page = await newSpecPage({
components: [Input],
html: '<ion-input title="my title" tabindex="-1" data-form-type="password"></ion-input>',
});
const nativeEl = page.body.querySelector('ion-input input');
expect(nativeEl.getAttribute('title')).toBe('my title');
expect(nativeEl.getAttribute('tabindex')).toBe('-1');
expect(nativeEl.getAttribute('data-form-type')).toBe('password');
});

View File

@ -0,0 +1,14 @@
import { newSpecPage } from '@stencil/core/testing';
import { Textarea } from '../textarea';
it('should inherit attributes', async () => {
const page = await newSpecPage({
components: [Textarea],
html: '<ion-textarea title="my title" tabindex="-1" data-form-type="password"></ion-textarea>',
});
const nativeEl = page.body.querySelector('ion-textarea textarea');
expect(nativeEl.getAttribute('title')).toBe('my title');
expect(nativeEl.getAttribute('tabindex')).toBe('-1');
expect(nativeEl.getAttribute('data-form-type')).toBe('password');
});

View File

@ -223,7 +223,7 @@ export class Textarea implements ComponentInterface {
componentWillLoad() {
this.inheritedAttributes = {
...inheritAriaAttributes(this.el),
...inheritAttributes(this.el, ['data-form-type', 'title']),
...inheritAttributes(this.el, ['data-form-type', 'title', 'tabindex']),
};
}