Skip to content

Control button CSS is unreliable #2136

@marcustyphoon

Description

@marcustyphoon

get_control_button_template: async function() {
await XKit.css_map.getCssMap();
var selector = XKit.css_map.keyToClasses("controlIcon").map(css => `[data-id]:first footer .${css}:first`).join(", ");
var control = $(selector);
var get_used_class_from_map = function(key) {
const keyCss = XKit.css_map.keyToCss(key);
var element = control.find(keyCss);
return element.attr("class");
};
var controlIconClass = control.attr("class");
var buttonClass = get_used_class_from_map("button");
var new_control = `
<div class="${controlIconClass} {{className}} xkit-interface-control-button" title="{{text}}" {{additional}}>
<button class="${buttonClass}" aria-label="" tabindex="0">
<div class="xkit-interface-icon" {{data}}></div>
</button>
</div>
`;
this.control_button_template = new_control;
return this.control_button_template;
},

[data-id]:first footer will not match anything in this code if the first post loaded by the user is a filtered post, which makes "controlIconClass" and "buttonClass" equal to the string 'undefined', which makes post controls look like this:

I assume there's no point in me reporting this, really, since this codebase is super dead and I would be the one fixing it if anyone would, but hey.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions