All of these have a touch screen
This is a great visual example of why you shouldn’t assume that having a touch screen always equals a phone or tablet.
This is a great visual example of why you shouldn’t assume that having a touch screen always equals a phone or tablet.
This isn’t in Drupal core yet, and may never be in this exact design, but I think it’s a pretty decent example of how to handle complex forms on the limited screen size on mobile devices and could be great inspiration.
This seems useful. Found on the Configuration schema/metadata Drupal 8 API guide on Drupal.org, which is super useful.
The Sass ampersand is incredibly useful in building selectors based on the parent selector, but it has a limitation. Take the following nested BEM-style selectors:
.component {
// A BEM modifier.
&--reversed {
background: white;
border-color: lightgray;
// Target a descendent only when the parent has the modifier? Not exactly...
&__child-element {
background: rebeccapurple;
}
}
}
The linked post explains the problem:
Wait, why is this not working? The problem is that the
&
has a scope of.component--reversed
, so&__child-element
compiles to.component--reversed__child-element
, which doesn’t [exist] in the markup.
The fix is to save the &
to a variable in the parent and use that in the child selector:
.component {
// Save the current value of & as $self.
$self: &;
&--reversed {
background: white;
border-color: lightgray;
// Print $self in place of & to get the correct scope of the parent above.
#{$self}__child-element {
background: rebeccapurple;
}
}
}
The compiled CSS for that element is now
.component--reversed .component__child-element
[.]
I just recently updated a bunch of my click handlers to not act when the Ctrl or Shift keys are pressed during the click, so that links can be opened in new tabs or windows by the user if so wanted:
// Don't do anything and defer to the default action if a modifier key
// was pressed during the click (to open the link in a new tab, window,
// etc.) - note that this is a truthy check rather than a strict check
// for the existence of and boolean true value of the various event
// properties:
// * https://ambientimpact.com/web/snippets/conditional-statements-and-truthy-values-robust-client-side-javascript
// * https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/ctrlKey
// * https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/shiftKey
if (event.ctrlKey || event.shiftKey) {
return;
}
With iOS 11.3, Apple has silently added support for the basic set of new technologies behind the idea of “Progressive Web Apps” (PWAs). It’s time to see how they work, what are their abilities and challenges, and what do you need to know if you already have a published PWA.
This looks like a great list of articles and reference material for working with Service Workers.