Accessible validation with aria-live | Forem

PHOTO EMBED

Fri Jun 17 2022 09:07:51 GMT+0000 (Coordinated Universal Time)

Saved by @metamoni #ruby #rubyonrails

# original code found at
# https://github.com/forem/forem/blob/5e93d3a25ecc800703aa100d286c8c75c9173ddf/app/views/users/edit.html.erb#L63
  
 <% if current_user.email.blank? %>
  <div class="crayons-notice crayons-notice--warning mb-6" aria-live="polite">
    <h3 class="mb-2"><%= t("views.settings.complete.heading") %></h3>
    <p>
      <%= t("views.settings.complete.desc") %>
      <% if @user.twitter_username.blank? %>
        <%= t("views.settings.complete.twitter") %>
      <% elsif @user.github_username.blank? %>
        <%= t("views.settings.complete.github") %>
      <% end %>
    </p>
  </div>
<% end %>
content_copyCOPY

https://github.com/forem/forem/blob/5e93d3a25ecc800703aa100d286c8c75c9173ddf/app/views/users/edit.html.erb#L63