Stacked bar plot with dropdown select menu

found the answer here: Is this a bug in dropdown events?

fixed code:
plot_ly(
data=dat,
type=“bar”,
color=~Gender) %>%
add_trace(y=~Employees, visible=T, color=~Gender)%>%
add_trace(y=~Payroll, visible=F, color=~Gender)%>%
layout(
yaxis=list(title=“value”),
barmode=“stack”,
updatemenus=list(
list(buttons=list(
list(method=“restyle”,
args=list(“visible”, list(TRUE, TRUE, FALSE, FALSE)),
label=“Employees”),
list(method=“restyle”,
args=list(“visible”, list(FALSE, FALSE, TRUE, TRUE)),
label=“Payroll”)
))
)
)