itmaybejj / editoria11y-wp

WordPress wrapper for Editoria11y
GNU General Public License v2.0
5 stars 1 forks source link

External link checker is confusing on blocks with multiple links #7

Closed cbirdsong closed 7 months ago

cbirdsong commented 1 year ago

It's a little confusing to have the whole block marked for review when it has multiple links, only one of which is external:

CleanShot 2023-04-20 at 08 39 39

It might be better if the message was anchored to the links themselves?

CleanShot 2023-04-20 at 08 49 59

Some rough CSS - it likely would need to be scoped to paragraphs/headings/lists and not every link:

.editor-styles-wrapper :not(.is-selected) a[target="_blank"] {
    position: relative;
    outline: 1px solid #fad859;
    outline-offset: 0;
    box-shadow: 0 0 0 2px #fad859;
    border-radius: 2px;
}

.editor-styles-wrapper :not(.is-selected) a[target*="_blank"]::after {
    content: "Manual check: is opening a new window expected?";
    position: absolute !important;
    bottom: 100% !important;
    left: -2px !important;
    width: auto !important;
    height: auto !important;
    background: #fad859 !important;
    color: #111 !important;
    display: inline-block !important;
    padding: 4px 4px 2px 6px !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
    font-weight: 500 !important;
    font-size: 13px !important;
    line-height: 1 !important;
    border-radius: 2px 0 0 0 !important;
    letter-spacing: 0 !important;
    z-index: 5 !important;
    pointer-events: none !important;
}
itmaybejj commented 1 year ago

Very much agreed. That's what I would like to do. I'm a little worried about conflicting with theme CSS though if I start modifying internal elements -- e.g., external link icons.

I think in the long run I need to implement it to work like the normal frontend checker -- just visually positioning toggles near elements. The challenge is doing that without modifying the DOM inside the block editor. I could generate my toggles at the end of the page and then position them absolutely relative to the page, which would work, at the cost of keyboard accessibility. But I'll play with your code and ponder in the interim.

cbirdsong commented 1 year ago

Personally, if I had a theme using external link icons I would probably be fine having them overridden by this tool in the editor?

itmaybejj commented 1 year ago

True. The only real excitement would be a partial replacement -- e.g., my content getting inserted, but having it bound by a max-width and clipped off or whatever. But that would be a bug for future me.

I'll have to experiment. I'm confident I can make it work, and I should be able to throw time at it this summer.

itmaybejj commented 7 months ago

Fixed in 1.0.13!