thoughtbot / middleman-aria_current

Accessibly indicate a current (active) link in Middleman
MIT License
8 stars 4 forks source link

Yield `ERB` block as contents #20

Closed seanpdoyle closed 4 years ago

seanpdoyle commented 4 years ago

Invoke the link_to helper with the original arguments, save for the modified options Hash.

Prior to this commit, the current_link_to helper was unable to yield a block and capture the contents to be rendered as children to the resulting <a> element.

The presence or absence of the &block as an argument is only useful to determine which index in the argument list references the link_to invocation's desired path value.

Since the text (or contents of the yield-ed block) is unmodified, we can delegate to the underlying link_to helper with the original "splatted" *arguments value.

tysongach commented 4 years ago

Does this help with and/or resolve https://github.com/thoughtbot/middleman-aria_current/issues/16?

seanpdoyle commented 4 years ago

It does!

seanpdoyle commented 4 years ago

I've tried to run the tests locally, but I haven't had any luck.

To prove that it works: https://github.com/seanpdoyle/git-read/commit/b53a0d941e26d69fd36cccfba1b5ffce74bc127a will build the navigation links on the left side of https://seanpdoyle.github.io/git-read/.

seanpdoyle commented 4 years ago

Merged into master as https://github.com/thoughtbot/middleman-aria_current/commit/16d3e539ae65ee515314661e415c5b21f1a1f28b.