The active element of a modal dialog is the first focusable element

The expectation looked incorrect; d1.firstChild is a text node which isn't focusable.