Skip to content

Commit 5aa6ab1

Browse files
Clarify use of global component settings in docs
- Moves SLDSSettings to settings to align with components
1 parent 58d7204 commit 5aa6ab1

File tree

5 files changed

+52
-36
lines changed

5 files changed

+52
-36
lines changed

components/SLDSSettings.js

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,4 @@
1-
/*
2-
Copyright (c) 2015, salesforce.com, inc. All rights reserved.
1+
// Alias
2+
import settings from './settings';
33

4-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
7-
Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
8-
9-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10-
*/
11-
12-
'use strict';
13-
import Modal from 'react-modal';
14-
15-
16-
let assetsPath = 'assets/';
17-
let appRoot;
18-
module.exports = {
19-
setAssetsPath: (path)=>{
20-
if(path){
21-
assetsPath = path;
22-
}
23-
},
24-
getAssetsPath: ()=>{
25-
return String(assetsPath);
26-
},
27-
setAppElement: (el)=>{
28-
if(el){
29-
appRoot = el;
30-
Modal.setAppElement(el);
31-
}
32-
},
33-
getAppElement: ()=>{
34-
return appRoot;
35-
}
36-
};
4+
module.exports = settings;

components/app-launcher/index.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,14 @@ import { APP_LAUNCHER } from '../../utilities/constants';
6363
* </AppLauncherSection>
6464
* </AppLauncher>
6565
* ```
66+
*
67+
* By default, `Modal`, a child component of App Launcher, will add `aria-hidden=true` to the `body` tag, but this disables some assistive technologies. To prevent this you can add the following to your application with `#mount` being the root node of your application that you would like hide from assistive technologies when the `Modal` is open.
68+
* ```
69+
* import settings from 'design-system-react/components/settings';
70+
* settings.setAppElement('#mount');
71+
* ```
6672
*/
73+
6774
const AppLauncher = React.createClass({
6875
// ### Display Name
6976
// Always use the canonical component name as the React display name.

components/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ Neither the name of salesforce.com, inc. nor the names of its contributors may b
99
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1010
*/
1111

12-
export SLDSSettings from './SLDSSettings';
12+
export SLDSSettings from './settings';
13+
export Settings from './settings';
1314

1415
export SLDSButton from './button';
1516
export Button from './button';

components/modal/index.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ const defaultProps = {
122122
/**
123123
* The Modal component is used for the Lightning Design System Modal and Notification > Prompt components. The Modal opens from a state change outside of the component itself (pass this state to the <code>isOpen</code> prop).
124124
* For more details on the Prompt markup, please review the <a href="http://www.lightningdesignsystem.com/components/notifications#prompt">Notifications > Prompt</a>.
125+
* By default, `Modal` will add `aria-hidden=true` to the `body` tag, but this disables some assistive technologies. To prevent this you can add the following to your application with `#mount` being the root node of your application that you would like hide from assistive technologies when the `Modal` is open.
126+
* ```
127+
* import settings from 'design-system-react/components/settings';
128+
* settings.setAppElement('#mount');
129+
* ```
125130
*/
126131
class Modal extends React.Component {
127132

components/settings.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
Copyright (c) 2015, salesforce.com, inc. All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6+
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
7+
Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
8+
9+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10+
*/
11+
12+
import Modal from 'react-modal';
13+
14+
/*
15+
* The following are component utility methods that aid in global settings.
16+
*/
17+
18+
let assetsPath = 'assets/';
19+
let appRoot;
20+
21+
module.exports = {
22+
setAssetsPath: (path) => {
23+
if (path) {
24+
assetsPath = path;
25+
}
26+
},
27+
getAssetsPath: () => String(assetsPath),
28+
setAppElement: (el) => {
29+
if (el) {
30+
appRoot = el;
31+
Modal.setAppElement(el);
32+
}
33+
},
34+
getAppElement: () => appRoot
35+
};

0 commit comments

Comments
 (0)