diff --git a/inst/htmlwidgets/plotly.js b/inst/htmlwidgets/plotly.js
index 5babe83890..56b78353bc 100644
--- a/inst/htmlwidgets/plotly.js
+++ b/inst/htmlwidgets/plotly.js
@@ -522,7 +522,7 @@ function TraceManager(graphDiv, highlight) {
// avoid doing this over and over
this.origOpacity = [];
for (var i = 0; i < this.origData.length; i++) {
- this.origOpacity[i] = this.origData[i].opacity || 1;
+ this.origOpacity[i] = this.origData[i].opacity === 0 ? 0 : (this.origData[i].opacity || 1);
}
// key: group name, value: null or array of keys representing the