SwiftUI custom font meta data requirements for "native" `.bold()` modifier - swiftui

From https://blog.eidinger.info/what-can-go-wrong-when-using-custom-fonts-in-swiftui I recently learned, that if we have a font-regular and font-bold SwiftUI can infer the bold font when we use the .bold() modifier, which is awesome. (If we registre them).
Now I have two licensed fonts, one where it works and one where it doesn't, and I wonder what in the meta-data of the fonts could break this behaviour?
I have the two fonts: SharpSans and SharpGrotesk, both in a medium and a bold format. For the SharpSans it all just works. It uses the medium as regular, and responds to .bold(), .fontWeight() and even SwiftUI.Text markdown boldness. However, for SharpGrotesk it only works by using .fontWeight() but I would very much like it to support both .bold() and SwiftUI.Text markdown formatting.

Related

How to remove text shadow on JSX tags

I want to remove this shadow:
So that it looks like a regular HTML:
How do I do that?
Normally (in HTML/XML file) that would be Tag style. And XML styles may be taking over HTML here (as an underlying language in IDE's styling hierarchy perhaps).
I'm not sure if this will work here but try this anyway (can be used in other scenarios):
Select some code (e.g. a whole tag) in such a file.
Invoke Help | Find Action... (or Search Everywhere and focus on "Actions" tab)
Locate Jump to Colors and Fonts entry there and invoke it.
See if a popup will have the related style listed (does not seem to list it here in PhpStorm using HTML+PHP file in my quick test -- only lists PHP styles).
P.S. It's not a "text shadow" but a background color.

Underline Text wrapped in another View

The SwiftUI modifier .underline() can be used to underline Text:
Text("Hello").underline()
Similarly, the modifier .font(…) can be used to change to font of text:
Text("A nice picture").font(.caption)
The .font(…) modifier also works on any View as well as a Text, so you can use .font() on a Group or HStack or your own View conforming struct. Doing so will change the font used by Text in that View – sweet. If I look up .font(), I can see it's an extension on View, so this makes sense, although seems rather magical!
However, the .underline() modifier can't (as far as I can tell) be used on any View to cause Text in it to be underlined. Similarly, .strikethrough() and .italic() and lots of other Text modifiers aren't available. They're defined as an extension on Text, so only work on this type.
I was wondering:
Is there a nice solution for this so that I can .underline() on parent view to get underlining on its contained Text children?
Why is SwiftUI currently like this?

Fix illegible macOS destructive alert button (SwiftUI)

The default dark-mode macOS Big Sur Alert.Button.destructive is illegible with salmon-on-gray coloring failing WCAG contrast requirements with a 1.7 score.
The Text view passed into it does not accept styling. Anyone have an idea to fix this or should an app's alert system stick to AppKit?

Sitecore rich text editor dialog, page scrolls to top

It appears that the default behavior for the rich text editor dialog in Page Editor is to scroll the entire page back to the top. This creates bad UX on long pages, since after you're done editing, you have to scroll back down the page and figure out where the text is that you edited.
Anyone know how to make the page stay scrolled to where it was?
I am not sure if it is related, since I am not able to reproduce your problem, but it reminds me of a bug in the Sitecore client that showed up in Internet Explorer and Firefox versions, where the content tree pane would do the same (scroll up after interaction). Please take a look at this StackOverflow question for a possible solution.
Furthermore I want to give you the advice to build up pages in Sitecore using small building blocks (multiple hierarchical placeholders with small renderings). Only then you would be able to leverage the full potential of the system, regarding page editing features and personalization. Also, only then a content editor can alter the presentation in the Experience Editor (Page Editor for older versions). Putting long pages of HTML-code in a single rich text editor field isn't recommended.
I fixed it changing the positioning of the jqueryModalDialogsFrame from absolut to fixed:
#jqueryModalDialogsFrame{
position:fixed !important;
top:0px !important;
left:0px !important;
}

What is the best way to fallback to the html5 input widgets on mobile, and using widget libs on desktops?

I have a application written in Django and my front-end uses AngularJS.
I'm making the application responsive; but I have some input widgets that don't play well on mobile screens (ex: datepicker, numberpicker, etc).
I want to disable these widgets on the mobile browsers, but I don't know the best way to do it.
For example, bootstrap datepicker is used as a embeddable component (as a div), but to transform it into a html5 input, I must replace it with a input type="text" and don't initialize the datepicker.
Should I make this change on my datepicker directive, or in the django template, returning the div or the input based on the browser?
I agree with https://stackoverflow.com/users/707111/minitech.
I would change the template to use the standard html elements, like <input type="date">, then use javascript to detect the device size and replace the code on desktop sizes only (until about 767px).
My advice for this procedure is that (usually) desktop browsers are much more powerful and faster at processing and coping with DOM transformations in real time. If that happens in a mobile device, it will be slower or more prone to errors/bugs. On desktops these DOM changes are nearly imperceptible.
As an alternative with less javascript, you can double all elements, using both standard and non-standard pairs. Then, add a class like .mobile to the standard ones, and .desktop to the others. Finally, on the css styles, use:
.mobile {display: none;} //all styles
#media only screen and (max-width: 767px) {
.mobile {display: block;}
.desktop {display: none;}
}
I also think this question is a good example of how standard html becomes more scalable for other devices.
Hope it helps.