Skip to content

Commit 9d905b2

Browse files
committed
fix(input-otp): hide description when there is no content
1 parent c5e97c3 commit 9d905b2

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

core/src/components/input-otp/input-otp.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@
130130
text-align: center;
131131
}
132132

133+
.input-otp-description-hidden {
134+
display: none;
135+
}
136+
133137
// Input Separator
134138
// ----------------------------------------------------------------
135139

core/src/components/input-otp/input-otp.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ export class InputOTP implements ComponentInterface {
726726
autocapitalize,
727727
color,
728728
disabled,
729+
el,
729730
fill,
730731
hasFocus,
731732
inheritedAttributes,
@@ -741,6 +742,7 @@ export class InputOTP implements ComponentInterface {
741742
const inputmode = this.getInputmode();
742743
const tabbableIndex = this.getTabbableIndex();
743744
const pattern = this.getPattern();
745+
const hasDescription = el.querySelector('.input-otp-description')?.textContent?.trim() !== '';
744746

745747
return (
746748
<Host
@@ -784,7 +786,11 @@ export class InputOTP implements ComponentInterface {
784786
</>
785787
))}
786788
</div>
787-
<div class="input-otp-description">
789+
<div
790+
class={{
791+
'input-otp-description': true,
792+
'input-otp-description-hidden': !hasDescription,
793+
}}>
788794
<slot></slot>
789795
</div>
790796
</Host>

0 commit comments

Comments
 (0)