mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-26 16:21:55 +08:00
fix(textarea): inherit tabindex to inner textarea (#26945)
resolves #26944
This commit is contained in:
14
core/src/components/input/test/input.spec.ts
Normal file
14
core/src/components/input/test/input.spec.ts
Normal 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');
|
||||
});
|
14
core/src/components/textarea/test/textarea.spec.ts
Normal file
14
core/src/components/textarea/test/textarea.spec.ts
Normal 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');
|
||||
});
|
@ -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']),
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user