Skip to content

Commit

Permalink
Unique IDs for vote-element.
Browse files Browse the repository at this point in the history
See #109.
  • Loading branch information
boonebgorges committed May 2, 2018
1 parent c24ba14 commit 1fcd18e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
10 changes: 8 additions & 2 deletions build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39151,6 +39151,8 @@ class ScoreDialog extends __WEBPACK_IMPORTED_MODULE_0_react___default.a.Componen
voteText = 'Join / login to like';
}

const voteElementId = 'vote-element-' + itemId;

const iconElement = __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('i', { 'aria-hidden': 'true', className: iconClass });

let voteElement;
Expand Down Expand Up @@ -39187,7 +39189,11 @@ class ScoreDialog extends __WEBPACK_IMPORTED_MODULE_0_react___default.a.Componen
if (!userCanVote) {
tooltip = __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
__WEBPACK_IMPORTED_MODULE_2_react_tooltip___default.a,
{ id: 'vote-element', type: 'info', className: 'login-tooltip' },
{
id: voteElementId,
type: 'info',
className: 'login-tooltip'
},
voteText
);
}
Expand All @@ -39207,7 +39213,7 @@ class ScoreDialog extends __WEBPACK_IMPORTED_MODULE_0_react___default.a.Componen
),
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
'span',
{ 'data-tip': true, 'data-for': 'vote-element' },
{ 'data-tip': true, 'data-for': voteElementId },
voteElement
),
tooltip
Expand Down
2 changes: 1 addition & 1 deletion build/index.js.map

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions src/components/ScoreDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export default class ScoreDialog extends React.Component {
voteText = 'Join / login to like'
}

const voteElementId = 'vote-element-' + itemId

const iconElement = <i aria-hidden="true" className={iconClass}></i>

let voteElement
Expand All @@ -68,7 +70,13 @@ export default class ScoreDialog extends React.Component {

let tooltip
if ( ! userCanVote ) {
tooltip = <ReactTooltip id='vote-element' type='info' className='login-tooltip'>{voteText}</ReactTooltip>
tooltip = (
<ReactTooltip
id={voteElementId}
type='info'
className='login-tooltip'
>{voteText}</ReactTooltip>
)
}

return (
Expand All @@ -79,7 +87,7 @@ export default class ScoreDialog extends React.Component {
</span>

{/* span wrapper is to allow tooltip on disabled button */}
<span data-tip data-for='vote-element'>
<span data-tip data-for={voteElementId}>
{voteElement}
</span>
{tooltip}
Expand Down

0 comments on commit 1fcd18e

Please sign in to comment.