I am currently attempting to showcase data in a table where each row features an info icon that is only visible upon hovering. Additionally, I want a pop-up to appear when the info icon is clicked (there is an onclick function assigned to this button).
Here's a snippet of the code I've written for this purpose:
<td className="reportCard">
{filteredVehicles.map(t =>
<tr className="cardList" onMouseEnter={() => this.onClickReportRow(t.reportId) }>
<span className="CardReportsName"><p className="reportNameP" >{t.reportName}</p></span>
<span style={PreviewBtn} className={this.selectedReportId == t.reportId ? "previewBtnDisplayBlock" : "previewBtnDisplayNone"}>
<em className="fa fa-info" aria-hidden="true" onClick={() => this.showPopUp()} />
</span>
</tr>
)}
</td>
onClickReportRow(reportId){
this.selectedReportId= reportId
}
Unfortunately, even though the hover event is triggered when I hover over a row, the conditional class does not change as expected. It seems to work fine if I use onclick, but when combined with Font Awesome's onclick, it fails to update the class.
This problem is quite perplexing and I'm unsure about the root cause.
Thank you in advance.