Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
13 changes: 12 additions & 1 deletion src/text-input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ export const TextInput = factory(function TextInput({
const inputFocused = focus.isFocused('input');
const autofilled = Boolean(icache.get('autofilled'));

let leadingElements;
if (leading) {
leadingElements = Array.isArray(leading) ? leading : [leading];
}

return (
<div key="root" classes={[theme.variant(), themeCss.root]} role="presentation">
<div
Expand Down Expand Up @@ -269,7 +274,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