<!DOCTYPE html>
<link rel=author href="mailto:jarhar@chromium.org">
<link rel=help href="http://crbug.com/1430405">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<dialog id=dialog popover=auto>
  <button id=button>button</button>
</dialog>

<dialog id=dialog2 popover=auto autofocus>
  <button id=button2>button</button>
</dialog>

<script>
test(() => {
  dialog.showPopover();
  assert_equals(document.activeElement, button);
}, 'Opening dialogs as popovers should use dialog initial focus algorithm.');

test(() => {
  dialog2.showPopover();
  assert_equals(document.activeElement, button2);
}, 'Opening dialogs as popovers which have autofocus should use dialog initial focus algorithm.');
</script>
