Conversation
navbar_item/1 declares attr :rest, :global, but target is not one of
Phoenix's global attributes, so the target="_blank" the navbar passes to it
was dropped at render time -- and Elixir 1.20 warned about it on every
compile:
warning: undefined attribute "target" for component
ErrorTracker.Web.Layouts.navbar_item/1
Adding target to the global include list puts it into @rest, the attribute
the <a> interpolates, so it renders and the warning goes away.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every compile on Elixir 1.20 warns about the navbar's own link:
The attribute is not only warned about, it is dropped.
targetis not one of Phoenix'sglobal attributes (
@globalsinphoenix_live_view/lib/phoenix_component/declarative.exhas
tabindex,title, and friends), sotarget="_blank"never makes it into@rest—the attribute the
<a>interpolates — and the GitHub link opens in the same tab.include: ~w(target)adds it to the global set, which is the documented way to extendattr :rest, :global. The attribute renders and the warning goes away.Found while pinning a fork of 0.9.0 for a downstream app on Elixir 1.20.2 /
phoenix_live_view 1.2.12. Related to #175.