Skip to content

Commit

Permalink
fix(template): add pointer events rule (#429)
Browse files Browse the repository at this point in the history
* fix(template): add pointer events rule

* test: regen snapshots

* fix: address pr feedback

* test: regen snapshots

* fix: minor fix

* fix: address pr feedback

* docs: minor tweak

* docs: minor tweak

* fix: address pr feedback
  • Loading branch information
portikM authored Oct 30, 2024
1 parent cc61b83 commit 24772ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Set the CSS `display` property for the icon wrapper element.
- required: `false`
- default: `false`

Whether the SVG is meaningful to the page, or just complimentary. Utilized to expose or hide the SVG from screen readers.
Whether the SVG is meaningful to the page, or just complimentary. Utilized to expose or hide the SVG from screen readers and enable or disable pointer events.

#### `size`

Expand Down
4 changes: 3 additions & 1 deletion src/__template__/ComponentTemplate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,15 @@ const iconSize = computed((): string => {
* We are adding styles inline to avoid additional stylesheet imports in the host application/component.
* All of the properties should be mapped to component props for customization.
*/
const rootElementStyles = computed((): Record<string, string> => ({
const rootElementStyles = computed((): Record<string, string | undefined> => ({
boxSizing: 'border-box',
color: props.color,
display: props.display,
flexShrink: '0',
height: iconSize.value,
lineHeight: '0',
width: iconSize.value,
pointerEvents: props.decorative ? 'none' : undefined,
}))
/**
Expand Down Expand Up @@ -155,6 +156,7 @@ const svgProcessedContent = `${svgTitleContent}${!props.staticIds ? prefixSvgIds
class="kui-icon {%%KONG_COMPONENT_ICON_CLASS%%}"
data-testid="kui-icon-wrapper-{%%KONG_COMPONENT_ICON_CLASS%%}"
:style="rootElementStyles"
:tabindex="decorative ? '-1' : undefined"
>
<svg
:aria-hidden="decorative ? 'true' : undefined"
Expand Down

0 comments on commit 24772ee

Please sign in to comment.