Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/text-input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { formatAriaProperties } from '../common/util';
import HelperText from '../helper-text/index';
import Label from '../label/index';
import * as css from '../theme/default/text-input.m.css';
import { isArray } from 'util';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if this is a correct import


export type TextInputType =
| 'text'
Expand Down Expand Up @@ -226,6 +227,11 @@ export const TextInput = factory(function TextInput({
const inputFocused = focus.isFocused('input');
const autofilled = Boolean(icache.get('autofilled'));

let leadingElements;
if (leading) {
leadingElements = isArray(leading) ? leading : [leading];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Array.isArray

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TEMPORARY INSANITY

}

return (
<div key="root" classes={[theme.variant(), themeCss.root]} role="presentation">
<div
Expand Down Expand Up @@ -269,7 +275,13 @@ export const TextInput = factory(function TextInput({
]}
role="presentation"
>
{leading && <span classes={themeCss.leading}>{leading}</span>}
{leadingElements && (
<virtual>
{leadingElements.map((leadingElement) => (
<span classes={themeCss.leading}>{leadingElement}</span>
))}
</virtual>
)}
<input
{...formatAriaProperties(aria)}
aria-invalid={valid === false ? 'true' : undefined}
Expand Down
6 changes: 5 additions & 1 deletion src/text-input/tests/unit/TextInput.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,11 @@ registerSuite('TextInput', {
},

'leading property'() {
const leading = <span classes={css.leading}>A</span>;
const leading = (
<virtual>
<span classes={css.leading}>A</span>
</virtual>
);
const leadingTemplate = baseAssertion
.setProperty('@wrapper', 'classes', [
css.wrapper,
Expand Down
2 changes: 0 additions & 2 deletions src/theme/dojo/chip-typeahead.m.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
}

.root .inputLeading {
display: block;
pointer-events: unset;
position: static;
transform: none;
max-width: 100%;
}

.root .inputWrapper {
Expand Down
2 changes: 0 additions & 2 deletions src/theme/material/chip-typeahead.m.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@
}

.root .inputLeading {
display: block;
pointer-events: unset;
position: static;
transform: none;
max-width: 100%;
}

.values .value {
Expand Down