-
Notifications
You must be signed in to change notification settings - Fork 7
Migrate Textarea to Label #153
Conversation
🦋 Changeset detectedLatest commit: b25e585 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
ab5a931
to
1c59fe2
Compare
.control { | ||
display: block; | ||
&.error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work in this case because the <textarea>
has a container. Input and Textarea are back to coloring their own borders.
'tooltip-and-label': true, | ||
hidden: this.hide, | ||
})} | ||
part="tooltip-and-label-container" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have much of a use for parts externally because we don't consumers to arbitrarily style components. But Label is private. This allows Textarea's one-off, vertically aligned label-and-tooltip to exist without Label explicitly accommodating it.
expect(element).to.have.attribute('rows', '2'); | ||
|
||
expect(textarea).to.exist; | ||
expect(textarea?.textContent).to.equal('value'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lit doesn't support expressions inside <textarea>
.
expect(label?.textContent?.trim()).to.be.equal('label'); | ||
}); | ||
|
||
it('renders a visually hidden label when attribute `hide-label` is set', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All now the responsibility of Label.
})} | ||
?disabled=${this.disabled} | ||
aria-describedby="description" | ||
aria-describedby="meta" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to match Input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got rid of the <div class="component" data-test="component">
wrapper.
} | ||
.character-count { | ||
font-weight: var(--cs-font-weight-bold); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The character count should only be bold when the count is invalid, not when Textarea is invalid for other reasons. I moved this below where it's only applied then. I moved the .input-box
border coloring closer to .input-box
for consistency.
display: flex; | ||
gap: var(--cs-spacing-xxs); | ||
line-height: var(--cs-body-xs-line-height); | ||
overflow: hidden; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused?
@state() | ||
private isReportValidityOrSubmit = false; | ||
|
||
#componentElementRef = createRef<HTMLDivElement>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch! I pushed a fix. |
🚀 Description
Textarea
spellcheck
andautocapitalize
attributes.gap
between the description and character count for long descriptions.label-position
toorientation
to bring it in line with Label and the other components.Input
Label
part::tooltip-and-label-container
for Textarea's vertically aligned label and tooltip.📋 Checklist
🔬 How to Test
We're planning to cut a release after this. I'd appreciate a second set of eyes on both components 🙏.
Known Issues
I found a few bugs while doing the migration that you may come across while testing. I'll create a ticket:
required
is removed programatically.📸 Images/Videos of Functionality
N/A