Skip to content

Commit

Permalink
make aria support to be disabled by default for compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
kzkn committed Jul 1, 2021
1 parent a7cacd5 commit 4589750
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 56 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Changelog

## Unreleased
* Support generating `aria-current` attribute. It's enabled by default
* Support generating `aria-current` attribute. It's disabled by default. See the readme for more info

## Version 4.2.0
* Support generating JSON-LD structured data. See the readme for more info (via #26, thanks @dkniffin)
Expand Down
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Option | Description
:posttext_class | CSS class for the posttext, if given. Can be set to `nil` for no class. | `"posttext"`
:container_tag | Tag type that contains the breadcrumbs. | `:div`
:fragment_tag | Tag type to contain each breadcrumb fragment/link. | None
:aria_current | Value of `aria-current` attribute. | `"page"`
:aria_current | Value of `aria-current` attribute. | None

### Styles

Expand Down Expand Up @@ -315,6 +315,25 @@ breadcrumbs do |links|
end
```

### ARIA support

You can improve the accessibility of your page with the markup that specified in [ARIA](https://www.w3.org/TR/wai-aria-practices/examples/breadcrumb/index.html). Gretel supports generating `aria-current` attribute:

```erb
<% breadcrumb :issue, @issue %>
<%= breadcrumbs aria_current: "page" %>
```

This will generate the following HTML (indented for readability):

```html
<div class="breadcrumbs">
<a href="/">Home</a> &rsaquo;
<a href="/issues">All issues</a> &rsaquo;
<span class="current" aria-current="page">My Issue</span>
</div>
```

## Documentation

* [Full documentation](https://rubydoc.info/gems/gretel)
Expand Down
2 changes: 1 addition & 1 deletion lib/gretel/renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Renderer
pretext_class: "pretext",
posttext_class: "posttext",
id: nil,
aria_current: "page"
aria_current: nil
}

DEFAULT_STYLES = {
Expand Down
Loading

0 comments on commit 4589750

Please sign in to comment.