Skip to content

Comments

Add warning in the Quick Start guides about Safari breaking Copy to Clipboard#3898

Merged
abey79 merged 7 commits intomainfrom
antoine/safari-copy-warning
Oct 17, 2023
Merged

Add warning in the Quick Start guides about Safari breaking Copy to Clipboard#3898
abey79 merged 7 commits intomainfrom
antoine/safari-copy-warning

Conversation

@abey79
Copy link
Member

@abey79 abey79 commented Oct 17, 2023

What

For security reason, Safari doesn't let use copy text from our Web viewer, see:

This PR detects if we are running on Safari and adds a warning to the top of the Quick Start guides.

image

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested demo.rerun.io (if applicable)
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG

@abey79 abey79 added 🕸️ web regarding running the viewer in a browser ui concerns graphical user interface include in changelog labels Oct 17, 2023
Comment on lines 352 to 359
#[cfg(target_arch = "wasm32")]
let result = web_sys::window()?.navigator().user_agent().ok();

#[cfg(not(target_arch = "wasm32"))]
let result = None;

result
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[cfg(target_arch = "wasm32")]
let result = web_sys::window()?.navigator().user_agent().ok();
#[cfg(not(target_arch = "wasm32"))]
let result = None;
result
}
#[cfg(target_arch = "wasm32")]
eframe::web::user_agent()
#[cfg(not(target_arch = "wasm32"))]
None
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't work.

image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the most compact I can think of:

fn user_agent() -> Option<String> {
    #[cfg(target_arch = "wasm32")]
    return eframe::web::user_agent();

    #[cfg(not(target_arch = "wasm32"))]
    None
}

@abey79 abey79 merged commit 8826c1d into main Oct 17, 2023
@abey79 abey79 deleted the antoine/safari-copy-warning branch October 17, 2023 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

include in changelog ui concerns graphical user interface 🕸️ web regarding running the viewer in a browser

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants