signatur 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signatur",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Simple Web App for Signatures",
5
5
  "keywords": [
6
6
  "html",
@@ -1764,6 +1764,11 @@ const countLines = function(text) {
1764
1764
  * Shows the accent popup above the pressed key with
1765
1765
  * the available accented character variants.
1766
1766
  *
1767
+ * The popup is appended to the document body (instead of the
1768
+ * keyboard container) and positioned with fixed coordinates so
1769
+ * it is never clipped by the container's overflow handling, which
1770
+ * would otherwise hide it for keys on the top keyboard row.
1771
+ *
1767
1772
  * @param {Element} context The keyboard container context.
1768
1773
  * @param {Element} element The key element that was long pressed.
1769
1774
  * @param {String} accents Comma-separated list of accented characters.
@@ -1793,13 +1798,14 @@ const countLines = function(text) {
1793
1798
 
1794
1799
  popup.append(arrow);
1795
1800
 
1796
- const offset = element.offset();
1797
- const containerOffset = context.offset();
1798
- const left = offset.left - containerOffset.left + element.outerWidth() / 2;
1799
- const top = offset.top - containerOffset.top;
1801
+ // positions the popup using viewport coordinates and anchors it
1802
+ // to the body so it escapes the keyboard container's clipping
1803
+ const rect = element[0].getBoundingClientRect();
1804
+ const left = rect.left + rect.width / 2;
1805
+ const top = rect.top;
1800
1806
  popup.css({ left: left + "px", top: top + "px" });
1801
1807
 
1802
- context.append(popup);
1808
+ body.append(popup);
1803
1809
 
1804
1810
  // dismisses the popup when clicking outside of it
1805
1811
  // by registering a one-time click handler on the document
@@ -74,6 +74,11 @@
74
74
  * Shows the accent popup above the pressed key with
75
75
  * the available accented character variants.
76
76
  *
77
+ * The popup is appended to the document body (instead of the
78
+ * keyboard container) and positioned with fixed coordinates so
79
+ * it is never clipped by the container's overflow handling, which
80
+ * would otherwise hide it for keys on the top keyboard row.
81
+ *
77
82
  * @param {Element} context The keyboard container context.
78
83
  * @param {Element} element The key element that was long pressed.
79
84
  * @param {String} accents Comma-separated list of accented characters.
@@ -103,13 +108,14 @@
103
108
 
104
109
  popup.append(arrow);
105
110
 
106
- const offset = element.offset();
107
- const containerOffset = context.offset();
108
- const left = offset.left - containerOffset.left + element.outerWidth() / 2;
109
- const top = offset.top - containerOffset.top;
111
+ // positions the popup using viewport coordinates and anchors it
112
+ // to the body so it escapes the keyboard container's clipping
113
+ const rect = element[0].getBoundingClientRect();
114
+ const left = rect.left + rect.width / 2;
115
+ const top = rect.top;
110
116
  popup.css({ left: left + "px", top: top + "px" });
111
117
 
112
- context.append(popup);
118
+ body.append(popup);
113
119
 
114
120
  // dismisses the popup when clicking outside of it
115
121
  // by registering a one-time click handler on the document