Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 7 commits into from Oct 17, 2023

Conversation

abey79
Copy link
Contributor

@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
crates/re_viewer/src/ui/welcome_screen/welcome_page.rs Outdated Show resolved Hide resolved
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
Contributor 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
Contributor 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
32 checks passed
@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.

None yet

2 participants