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

Some messages do not show up correctly on a dark background when built-in dark mode is disabled #7

Open
jerboa88 opened this issue Jan 8, 2021 · 1 comment
Labels
🛡 Priority: Medium Issue is of medium priority ⏰ Status: Confirmed Issue has been reproduced 🗃 Type: Bug Something isn't working

Comments

@jerboa88
Copy link
Owner

jerboa88 commented Jan 8, 2021

Describe the bug
Originally reported by Derrick. When the built-in Outlook dark mode is not enabled (and sometimes it is completely disabled by admins on O365), some messages do not show up correctly on a dark background. There are currently styles to try to force message text to display as a lighter color, but this does not always work as there are an infinite amount of ways an email can be structured.

This is an issue both while writing and viewing emails.

Potential solutions:

  1. Send PATCH request to https://consumer.suite.office.com/api/settings/usertheme with payload {"IsDarkmode":true}. In testing this endpoint seems to be blocked by CORS, so I'm unsure if forcing a request through would have any effect. Manually replaying the XHR does nothing either. Interestingly, this request is triggered when updating the themeData.IsDarkTheme property via React DevTools, although changing the property doesn't actually update the page.
  2. Modify React properties that control dark mode and force an update. The relevant property is $r.props.themeData.IsDarkTheme. This could be challenging because it seems like Outlook exclusively uses props instead of state, and I'm not aware of a method of updating the props and triggering an update after the props are first defined. We may have to modify the relevant property before any React components are loaded if using this approach.
  3. Send POST request to https://outlook.live.com/owa/0/service.svc?action=UpdateUserConfiguration&app=Mail&n=xx with payload: {"__type":"UpdateUserConfigurationJsonRequest:#Exchange","Header":{"__type":"JsonRequestHeaders:#Exchange","RequestServerVersion":"V2018_01_08","TimeZoneContext":{"__type":"TimeZoneContext:#Exchange","TimeZoneDefinition":{"__type":"TimeZoneDefinitionType:#Exchange","Id":"Mountain Standard Time"}}},"Body":{"__type":"UpdateUserConfigurationOwaRequest:#Exchange","UserConfiguration":{"__type":"ServiceUserConfiguration:#Exchange","UserConfigurationName":{"__type":"UserConfigurationNameType:#Exchange","BaseFolderId":{"__type":"DistinguishedFolderId:#Exchange","Id":"root"},"Name":"OWA.UserOptions"},"Dictionary":[{"__type":"UserConfigurationDictionaryEntry:#Exchange","DictionaryKey":{"__type":"UserConfigurationDictionaryObject:#Exchange","Type":"String","Value":["isDarkModeTheme"]},"DictionaryValue":{"__type":"UserConfigurationDictionaryObject:#Exchange","Type":"Boolean","Value":["true"]}}]}}}. This seems to be the endpoint that actually updates user configuration.
  4. Inject a script that performs contrast-checking on each piece of text and adjusts the colors as appropriate. Apparently this is what Outlook does themselves to make emails readable when using the built-in dark mode, but it seems more difficult to deobfuscate the original code that does this instead of rewriting it from scratch. This may be the only way of fixing message styling since the methods above may not work with O365.
@jerboa88 jerboa88 added 🗃 Type: Bug Something isn't working ⏰ Status: New Issue has not been investigated yet 🛡 Priority: Medium Issue is of medium priority ⏰ Status: Confirmed Issue has been reproduced and removed ⏰ Status: New Issue has not been investigated yet labels Jan 8, 2021
@jerboa88
Copy link
Owner Author

Added an experimental option to force enable compose pane styling in situations where the built-in Outlook dark mode is not available here: 459dcf1. This ensures we do not have any conflicts with styles generated by Outlook when the built-in dark mode is enabled.

A better solution is still required for users that do not have access to the built-in dark mode, but because this issue is pretty complex and time-consuming, I am putting this on hold for the time being.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🛡 Priority: Medium Issue is of medium priority ⏰ Status: Confirmed Issue has been reproduced 🗃 Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant