Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
woylie committed Jan 8, 2024
1 parent 6333086 commit 4ca6785
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/doggo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3011,6 +3011,16 @@ defmodule Doggo do

attr :title, :string, default: "required"

# inputs are announced as required by screen readers if the `required`
# attribute is set. This makes this mark purely visual. `aria-hidden="true"`
# is added so that screen readers don't announce redundant information. The
# title attribute has poor accessibility characteristics, but since this is
# purely presentational, this is acceptable.
# It is good practice to add a sentence explaining that fields marked with an
# asterisk (*) are required to the form.
# Alternatively, the word `required` might be used instead of an asterisk. In
# that case, the text should still be aria-hidden. But also, this wouldn't be
# an abbr anymore.
defp required_mark(assigns) do
~H"""
<abbr class="label-required" aria-hidden="true" title={@title}>*</abbr>
Expand Down

0 comments on commit 4ca6785

Please sign in to comment.