when toggling the logs button the selection is off-screen and selection.toString() is empty even when there is a selected range. Can check for selection.type being "Range" instead.