Skip to content

Commit

Permalink
feat: buttons, links and elements with tooltips now keyboard accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
istudyatuni committed Oct 15, 2023
1 parent 461e544 commit b07f103
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/components/Main.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<h4 class="city-name">{$settings.current_city.name}</h4>
<a class="map" href={map_link}>
<Tooltip position="right" text={$_('header.maps.tooltip')}>
<MapIcon />
<MapIcon width="20" height="20" />
</Tooltip>
</a>
</div>
Expand All @@ -43,14 +43,16 @@
href={settingsNotOpened ? '/' : '/settings'}
class="settings"
alt="settings toggle"
tabindex="0"
on:click={() => (settingsNotOpened = !settingsNotOpened)}>
<SettingsIcon width="30" height="30" />
</a>

<a
href="https://github.com/istudyatuni/weather-site"
alt="github"
class="github">
class="github"
tabindex="0">
<GithubIcon width="30" height="30" />
</a>
</div>
Expand Down
8 changes: 5 additions & 3 deletions src/components/atoms/Tooltip.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
position = 'top'
</script>

<div class="tooltip {position}">
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
<div class="tooltip {position}" tabindex="0" >
<slot />
<div class="text">{text}</div>
<div class="text" role="tooltip">{text}</div>
</div>

<style lang="scss">
Expand Down Expand Up @@ -77,7 +78,8 @@
}
/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .text {
.tooltip:hover .text,
.tooltip:focus .text {
visibility: visible;
opacity: 1;
}
Expand Down

0 comments on commit b07f103

Please sign in to comment.