For me, Safari, Chrome, and Firefox all return lowercase “z” on macOS when shiftKey is down, which deviates from the documented “taking into consideration the state of modifier keys”. I can’t reproduce the behavior you describe, but it is consistent with the linked documentation.