@centreon/ui 24.4.53 → 24.4.54

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": "@centreon/ui",
3
- "version": "24.4.53",
3
+ "version": "24.4.54",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx --max-warnings 0",
@@ -22,6 +22,8 @@ const ChildComponent = (): JSX.Element => {
22
22
  <Button onClick={() => toggleFullscreen(document.body)}>
23
23
  {isFullscreenActivated ? labelExitFullscreen : labelEnterFullscreen}
24
24
  </Button>
25
+ <input id="input" />
26
+ <textarea id="textarea" />
25
27
  </div>
26
28
  );
27
29
  };
@@ -94,16 +96,35 @@ describe('Fullscreen', () => {
94
96
  .should('have.attr', 'data-fullscreenActivated', 'false')
95
97
  .should('have.attr', 'data-fullscreenEnabled', 'true');
96
98
 
97
- cy.get('#test').realPress(['Alt', 'F']);
99
+ cy.get('#test').realPress(['F']);
98
100
 
99
101
  cy.get('#test')
100
102
  .should('have.attr', 'data-fullscreenActivated', 'true')
101
103
  .should('have.attr', 'data-fullscreenEnabled', 'true');
102
104
 
103
- cy.get('#test').realPress(['Alt', 'F']);
105
+ cy.get('#test').realPress(['F']);
104
106
 
105
107
  cy.get('#test')
106
108
  .should('have.attr', 'data-fullscreenActivated', 'false')
107
109
  .should('have.attr', 'data-fullscreenEnabled', 'true');
108
110
  });
111
+
112
+ ['input', 'textarea'].forEach((tag) => {
113
+ it(`cannot toggle fullscreen feature using the shortcut when ${tag === 'input' ? 'an' : 'a'} ${tag} is focused`, () => {
114
+ initialize();
115
+
116
+ cy.get('#test')
117
+ .should('have.attr', 'data-fullscreenActivated', 'false')
118
+ .should('have.attr', 'data-fullscreenEnabled', 'true');
119
+
120
+ cy.get(`#${tag}`).focus();
121
+
122
+ cy.get('#test').realPress(['F']);
123
+
124
+ cy.get('#test')
125
+ .should('have.attr', 'data-fullscreenActivated', 'false')
126
+ .should('have.attr', 'data-fullscreenEnabled', 'true');
127
+ cy.get(`#${tag}`).should('have.value', 'F');
128
+ });
129
+ });
109
130
  });
@@ -1,6 +1,6 @@
1
1
  import { useEffect } from 'react';
2
2
 
3
- import { equals } from 'ramda';
3
+ import { equals, includes } from 'ramda';
4
4
  import { useSearchParams } from 'react-router-dom';
5
5
 
6
6
  import { useDeepCompare } from '../useMemoComponent';
@@ -16,7 +16,10 @@ export const useFullscreenListener = (): boolean => {
16
16
  useFullscreen();
17
17
 
18
18
  const toggle = (event: KeyboardEvent): void => {
19
- if (!event.altKey || !equals(event.code, 'KeyF')) {
19
+ if (
20
+ includes(document.activeElement?.tagName, ['INPUT', 'TEXTAREA']) ||
21
+ !equals(event.code, 'KeyF')
22
+ ) {
20
23
  return;
21
24
  }
22
25