@@ -128,10 +128,11 @@ export class DropdownItem implements LoadableComponent {
128
128
129
129
render ( ) : VNode {
130
130
const scale = getElementProp ( this . el , "scale" , this . scale ) ;
131
+ const { href, selectionMode, label, iconFlipRtl } = this ;
131
132
const iconStartEl = (
132
133
< calcite-icon
133
134
class = { CSS . iconStart }
134
- flipRtl = { this . iconFlipRtl === "start" || this . iconFlipRtl === "both" }
135
+ flipRtl = { iconFlipRtl === "start" || iconFlipRtl === "both" }
135
136
icon = { this . iconStart }
136
137
scale = { scale === "l" ? "m" : "s" }
137
138
/>
@@ -144,7 +145,7 @@ export class DropdownItem implements LoadableComponent {
144
145
const iconEndEl = (
145
146
< calcite-icon
146
147
class = { CSS . iconEnd }
147
- flipRtl = { this . iconFlipRtl === "end" || this . iconFlipRtl === "both" }
148
+ flipRtl = { iconFlipRtl === "end" || iconFlipRtl === "both" }
148
149
icon = { this . iconEnd }
149
150
scale = { scale === "l" ? "m" : "s" }
150
151
/>
@@ -159,13 +160,13 @@ export class DropdownItem implements LoadableComponent {
159
160
? [ contentNode , iconEndEl ]
160
161
: contentNode ;
161
162
162
- const contentEl = ! this . href ? (
163
+ const contentEl = ! href ? (
163
164
slottedContent
164
165
) : (
165
166
< a
166
- aria-label = { this . label }
167
+ aria-label = { label }
167
168
class = { CSS . link }
168
- href = { this . href }
169
+ href = { href }
169
170
rel = { this . rel }
170
171
tabIndex = { - 1 }
171
172
target = { this . target }
@@ -176,34 +177,34 @@ export class DropdownItem implements LoadableComponent {
176
177
</ a >
177
178
) ;
178
179
179
- const itemRole = this . href
180
+ const itemRole = href
180
181
? null
181
- : this . selectionMode === "single"
182
+ : selectionMode === "single"
182
183
? "menuitemradio"
183
- : this . selectionMode === "multiple"
184
+ : selectionMode === "multiple"
184
185
? "menuitemcheckbox"
185
186
: "menuitem" ;
186
187
187
- const itemAria = this . selectionMode !== "none" ? toAriaBoolean ( this . selected ) : null ;
188
+ const itemAria = selectionMode !== "none" ? toAriaBoolean ( this . selected ) : null ;
188
189
189
190
return (
190
- < Host aria-checked = { itemAria } role = { itemRole } tabindex = "0" >
191
+ < Host aria-checked = { itemAria } aria-label = { ! href ? label : "" } role = { itemRole } tabindex = "0" >
191
192
< div
192
193
class = { {
193
194
container : true ,
194
- [ CSS . containerLink ] : ! ! this . href ,
195
+ [ CSS . containerLink ] : ! ! href ,
195
196
[ CSS . containerSmall ] : scale === "s" ,
196
197
[ CSS . containerMedium ] : scale === "m" ,
197
198
[ CSS . containerLarge ] : scale === "l" ,
198
- [ CSS . containerMulti ] : this . selectionMode === "multiple" ,
199
- [ CSS . containerSingle ] : this . selectionMode === "single" ,
200
- [ CSS . containerNone ] : this . selectionMode === "none"
199
+ [ CSS . containerMulti ] : selectionMode === "multiple" ,
200
+ [ CSS . containerSingle ] : selectionMode === "single" ,
201
+ [ CSS . containerNone ] : selectionMode === "none"
201
202
} }
202
203
>
203
- { this . selectionMode !== "none" ? (
204
+ { selectionMode !== "none" ? (
204
205
< calcite-icon
205
206
class = { CSS . icon }
206
- icon = { this . selectionMode === "multiple" ? "check" : "bullet-point" }
207
+ icon = { selectionMode === "multiple" ? "check" : "bullet-point" }
207
208
scale = { scale === "l" ? "m" : "s" }
208
209
/>
209
210
) : null }
0 commit comments