So,
The function setAttributeis vanilla javascript, so it must be used in a real javascript HTML element.
You have 2 options,
Solution 1
Get the html javascript element using a function each, and then get it from this.
d3.selectAll('.nv-slice').each(function(){
this.setAttribute("tabindex", "0");
});
Decision 2
, , jQuery ( ) , setAttribute, attr.
d3.selectAll('.nv-slice').attr("tabindex", "0");
, .