Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Tooltip [object Object] when cursor hover to tab #32

Open
Arttse opened this issue Apr 19, 2018 · 1 comment
Open

Tooltip [object Object] when cursor hover to tab #32

Arttse opened this issue Apr 19, 2018 · 1 comment

Comments

@Arttse
Copy link

Arttse commented Apr 19, 2018

hover- object_object


Hyper 2.0.0 (stable)
hyper-tabs-enhanced 0.4.2
Linux Ubuntu 16.04

@JJJ
Copy link

JJJ commented Nov 25, 2022

jjj-on-2022-11-24-at-18-29-17@2x

                           Still happening --^ 😅

I've kinda tracked it down:

// Current process icon
const getIcon = (title) => {
const process = title.match(/(?:[\s]+|^)(gulp|php|node|npm|yarn|vim|nvim|python|mysql)(?:[\s]+|\d+$)/i);
return process ? process[0].trim().toLowerCase() : 'shell';
};
// Tab process icons
exports.decorateTab = (Tab, { React }) => {
return class extends Tab {
render() {
const icon = getIcon(this.props.text);
this.props.text = React.createElement('span', { className: `tab_process process_${icon}` }, this.props.text);
return React.createElement(Tab, Object.assign({}, this.props, {}));
}
}
};
exports.decorateTabs = (Tabs, { React }) => {
return class extends Tabs {
render() {
if (this.props.tabs.length === 1 && typeof this.props.tabs[0].title === 'string') {
const icon = getIcon(this.props.tabs[0].title);
this.props.tabs[0].title = React.createElement('span', { className: `tab_process process_${icon}` }, this.props.tabs[0].title);
}
return React.createElement(Tabs, Object.assign({}, this.props, {}));
}
}
};

  1. Tab.title is the string used to source the icon
  2. this.props.tabs[0].title is updated to contain a <span> element as the icon, which is technically an invalid use of the title attribute
  3. It appears that title attribute & text are setup to react to one another

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants