Skip to content

Better Footnote title attributes? #387

@edent

Description

@edent

Footnote links' titles can only be set once by the library. This change would make the attribute display the content of the footnote.

How

At the moment, if a user hovers over a footnote, the title attribute displays a tool tip.

For example, if

public string $fn_link_title = "";

is set to "Read the footnote." then all footnotes have this pop-up:

Screenshot of a pop up which says 'read the footnote'


I think it would be nice if it showed users the full text of the footnote. For example:

The pop up now displays the full note


This is controlled by :

$title = $this->fn_link_title;

The change is relatively straightforward:

if ($this->fn_link_title != "") {
	$title = trim( strip_tags( $this->footnotes[$node_id] ) );
	$title = $this->encodeAttribute( $title );
	$attr .= " title=\"$title\"";
}

That takes the text of the footnote, sanitises it, and adds it as the title element.

Would you be interested in a PR for this?

(I have also raised this with WordPress's Jetpack which is running an older version of your library - Automattic/jetpack#27387)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions