MCPcopy Create free account
hub / github.com/ionic-team/ionic-framework / render

Method render

core/src/components/item/item.tsx:269–415  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

267 }
268
269 render() {
270 const {
271 detail,
272 detailIcon,
273 download,
274 labelColorStyles,
275 lines,
276 disabled,
277 href,
278 rel,
279 target,
280 routerAnimation,
281 routerDirection,
282 inheritedAriaAttributes,
283 multipleInputs,
284 } = this;
285 const childStyles = {} as StyleEventDetail;
286 const mode = getIonMode(this);
287 const clickable = this.isClickable();
288 const canActivate = this.canActivate();
289 const TagType = clickable ? (href === undefined ? 'button' : 'a') : ('div' as any);
290
291 const attrs =
292 TagType === 'button'
293 ? { type: this.type }
294 : {
295 download,
296 href,
297 rel,
298 target,
299 };
300
301 let clickFn = {};
302
303 const firstInteractive = this.getFirstInteractive();
304
305 // Only set onClick if the item is clickable to prevent screen
306 // readers from reading all items as clickable
307 if (clickable || (firstInteractive !== undefined && !multipleInputs)) {
308 clickFn = {
309 onClick: (ev: MouseEvent) => {
310 if (clickable) {
311 openURL(href, ev, routerDirection, routerAnimation);
312 }
313 if (firstInteractive !== undefined && !multipleInputs) {
314 const path = ev.composedPath();
315 const target = path[0] as HTMLElement;
316
317 if (ev.isTrusted) {
318 /**
319 * Dispatches a click event to the first interactive element,
320 * when it is the result of a user clicking on the item.
321 *
322 * We check if the click target is in the shadow root,
323 * which means the user clicked on the .item-native or
324 * .item-inner padding.
325 */
326 const clickedWithinShadowRoot = this.el.shadowRoot!.contains(target);

Callers

nothing calls this directly

Calls 8

isClickableMethod · 0.95
canActivateMethod · 0.95
getFirstInteractiveMethod · 0.95
getIonModeFunction · 0.90
openURLFunction · 0.90
hostContextFunction · 0.90
createColorClassesFunction · 0.90
setFocusMethod · 0.45

Tested by

no test coverage detected